On Tue, May 27, 2014 at 6:58 PM, Serhiy Storchaka <storch...@gmail.com> wrote:
> 26.05.14 10:59, raymond.hettinger написав(ла):
>>
>> +        result = [(elem, i) for i, elem in zip(range(n), it)]
>
>
> Perhaps it is worth to add simple comment explaining why this is not
> equivalent to just list(zip(it, range(n))). Otherwise it can be
> unintentionally "optimized" in future.
>

Where is the difference? I'm very much puzzled now. My first thought
was based on differing-length iterables in zip, but the docs say it
stops at the shortest of its args.

ChrisA
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to