Moving to functional programming
tjreedy at udel.edu
Mon Jul 14 20:17:49 CEST 2008
James Fassett wrote:
>> 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