anonymous functions/expressions without lambda?

Paul Miller paul at fxtech.com
Thu Apr 28 16:12:49 EDT 2005


Michael Hoffman wrote:
> Paul Miller wrote:
> 
>> While on the subject, is there an equivalent for "methodcaller"?
>>
>> ie. if I want to bind a function which calls a specific method of an 
>> object with a specific parameter?
>>
> 
> def funccaller(func, *args, **kwargs):
>     def _return_func():
>         return func(*args, **kwargs)
>     return _return_func

...

> And this time I actually tested it, and it works! ;)

Wow! Amazing. Yer right, it works!

Man, I LOVE this language.




More information about the Python-list mailing list