better lambda support in the future?

Michael Hoffman at
Fri Dec 17 23:15:22 CET 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>
 >>> _()
 >>> A(0)
<function B at 0xa0c65dc>
 >>> _()
Michael Hoffman

More information about the Python-list mailing list