On Wed, Jul 20, 2016 at 1:16 PM, Random832 <random...@fastmail.com> wrote:
> 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)

Makes it a little too easy to commit an off-by-one error, I think. As
you did here.
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to