Optimizing list processing

Terry Reedy tjreedy at udel.edu
Thu Dec 12 13:07:49 EST 2013


On 12/12/2013 6:09 AM, Stefan Behnel wrote:
> Terry Reedy, 12.12.2013 03:26:
>> from itertools import count
>> table = sorted(t for t in zip(iterable, count))
>
> This is a useless use of a generator expression. sorted(zip(...)) is enough
> (and likely to be substantially faster also).

Yes, definitely, and thank you. I did not squeeze enough.

-- 
Terry Jan Reedy




More information about the Python-list mailing list