Is there an elegant pythonic way of removing trailing empty elements from a list? A sort of list.rstrip(None). So
[1, 2, 3, None, 4, None, None]
should result in
[1, 2, 3, None, 4]
I guess this could be generalized to removing trailing elements of any particular value.
If possible, I would like to have this done as a single line (readable) expression