annonymous functions -- how to
D H
a at b.c
Thu May 5 11:12:11 EDT 2005
Peter Hansen wrote:
> Jason Mobarak wrote:
>
>> What's wrong with:
>>
>> def blah():
>> def _ (a, b, c):
>> a = a + 2
>> print "stmt 2"
>> return a+b/c
>> return doSomethingWith(_)
>>
>> It's basically "anonymous", it just uses a name that you don't care
>> about. AFAIK, it can be immediately clobbered later if need be.
>> Otherwise, the function shouldn't be anonymous.
>
>
> Or even better:
Python doesn't have anonymous functions.
See http://boo.codehaus.org/Closures
and the closures examples here:
http://svn.boo.codehaus.org/trunk/tests/testcases/integration/
More information about the Python-list
mailing list