Why is map() preferable in this case?

Delaney, Timothy (Tim) tdelaney at avaya.com
Tue Sep 20 00:10:28 CEST 2005

Devan L wrote:

> Map is in C. It's faster, but not as clear. Some people do think
> map(f, L) is nicer though. Google is your friend here, if you want to
> read the old arguments.

map() will be faster if the function you are calling from map() is
*also* in coded in C. If it's coded in python, then the generator
expression will probably be faster.

Use whatever reads better to you. Look at optimising when you need to,
and not before.

Tim Delaney

More information about the Python-list mailing list