map versus the 'for' loop

Gordon McMillan gmcm at hypernet.com
Sat Dec 4 20:10:49 EST 1999


Will Ware wrote:

> Tim Peters (tim_one at email.msn.com) wrote:
> > If func is None, map is much faster....
> > If func is some builtin operation (like "+" or "len") spelled
> > at least roughly the same way in both cases, ... map will
> > usually be significantly faster
> 
> Pardon my density: I can easily see how to do this with "len",
> since I can type "len" at the prompt and get a "<built-in
> function len>" object back, but I can't see how to do that with
> "+". The best I've been able to come up with is the lambda that
> you later say isn't a good idea. How do I obtain a "<built-in
> function +>" object? -- 

import operator



- Gordon




More information about the Python-list mailing list