reversed(enumerate(x))

Random832 random832 at fastmail.com
Wed Jul 20 15:16:11 EDT 2016


On Wed, Jul 20, 2016, at 13:42, Ian Kelly wrote:
> I had occasion to write something like this:
> 
>     for i, n in reversed(enumerate(x)): pass
> 
> How would you write this?

I'd write my own version of enumerate with a step argument, and call
enumerate(reversed(x), start=len(x), step=-1)



More information about the Python-list mailing list