better lambda support in the future?
Michael Hoffman
m.h.3.9.1.without.dots.at.cam.ac.uk at example.com
Fri Dec 17 17:15:22 EST 2004
Jason Zheng wrote:
> The true beauty of lambda function is not the convenience of creating
> functions without naming them. Lambda constructs truly enables
> higher-order function. For example, I can create a function A that
> returns a function B that does something interesting according to the
> arguments that I pass to function A.
How does that differ from this?
>>> def A(x):
... if x:
... def B(): return "True"
... else:
... def B(): return "False"
... return B
...
>>> A(1)
<function B at 0xa0c65dc>
>>> _()
'True'
>>> A(0)
<function B at 0xa0c65dc>
>>> _()
'False'
--
Michael Hoffman
More information about the Python-list
mailing list