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
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to