map versus the 'for' loop

Neel Krishnaswami neelk at brick.cswv.com
Sun Dec 5 08:39:57 EST 1999


Will Ware <wware-nospam at world.std.com> wrote:
>
>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?

Python 1.5.2 (#8, May 12 1999, 17:46:31)  [GCC 2.7.2.1] on linux2
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam

>>> import operator
>>> operator.add(3,4)
7

It also contains versions for the other common operators. 


Neel




More information about the Python-list mailing list