Moving to functional programming

Terry Reedy tjreedy at udel.edu
Mon Jul 14 14:17:49 EDT 2008



James Fassett wrote:
<zip> ...
>> robust and efficient than the list comprehension.
> 
> I don't know the internals of how the Python interpreter treats list
> comprehensions and zip but it seems reasonable to assume an extra list
> is created for the zip approach.

Minor times differences between this and that way of writing things tend 
to be version and even system dependent.  In 3.0, for instance, zip 
produces an iterator, not a list.  So it will be faster.  On the other 
hand, list comprehensions will be a bit slower to fix what many, 
including Guido, consider to be a slight design bug.




More information about the Python-list mailing list