Performance of list comprehensions vs. map

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Fri Sep 7 16:49:29 EDT 2001


Fri, 07 Sep 2001 20:17:12 GMT, Paul Winkler <slinkp23 at yahoo.com> pisze:

> So for the foreseeable future, looks like map() is likely to remain
> the fastest way to generate lists.

As long as the function to map is ready. If a separate function must
be created just for mapping (doesn't matter id by 'def' or 'lambda'),
I would expect a list comprehension with the function's body inserted
to be faster than map which must call it.

-- 
 __("<  Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/
 \__/
  ^^                      SYGNATURA ZASTĘPCZA
QRCZAK



More information about the Python-list mailing list