callbacks in python

Alexandru Mosoi brtzsnr at gmail.com
Wed Aug 13 17:29:07 EDT 2008


On Aug 14, 12:02 am, Fredrik Lundh <fred... at pythonware.com> wrote:
> your use of the word "callback" is a bit unusual, and your example isn't
> valid Python code, but it looks as if functools.partial might be what
> you need:
>
>      http://docs.python.org/lib/module-functools.html

my current implementation is very similar to partial() :) (10x, i'll
use partial from now on). however it seems that I don't understand
very well positional and keyword arguments in python because I got the
error described here: http://docs.python.org/ref/calls.html#calls
(TypeError: f() got multiple values for keyword argument 'a') which
confused me even more. so if you pass positional and keyword arguments
to both partial() and function returned the order of passed arguments
might be different than expected. i was looking for an implementation
that somehow avoids this confusion.



More information about the Python-list mailing list