> On Jul 20, 2016, at 12:42 PM, Ian Kelly <ian.g.ke...@gmail.com> wrote:
> 
>    for i, n in reversed(enumerate(x)): pass
> 
> fails with "TypeError: argument to reversed() must be a sequence".

So make it a sequence:
    for i, n in reversed(list(enumerate(x))): pass

If ``x`` is very large, you can use your zip/range technique to save memory.
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to