callbacks in python
Bruno Desthuilliers
bruno.42.desthuilliers at websiteburo.invalid
Thu Aug 14 03:36:41 EDT 2008
Bruno Desthuilliers a écrit :
> Alexandru Mosoi a écrit :
>> does anyone know a nice implementation of callbacks in python? i have
>> issues mixing named & unamed parameters. i want build a callback over
>> a function such that some parameters are passed when callback is
>> created and the rest are passed when the function is called.
>>
>> example:
>> callback = Callback(function, x=1, y)
>> callback(z, t=4, u)
>
> from functools import partial
>
> callback = partial(some_func, x=1, y)
> callback(z, t=4, u)
Stupid copy-paste :(
callback = partial(some_func, y, x=1)
callback(z, u, t=4)
More information about the Python-list
mailing list