
Jan. 21, 2021
3:22 a.m.
So, what is the conclusion? I also think reversed(enumerate(some_seq)) will be very useful in many cases. It should: 1) work the same as reversed(tuple(enumerate(...))) for "reversible" objects as argument of enumerate, 2) raise TypeError if the object is not reversible. Or, another option would be adding a "step" keyword argument to enumerate. Then, reversing enumerate would be much easier, like this: enumerate(reversed(some_seq), step=-1)