On Wed, 10 Feb 2010 18:31:23 +0000, Arnaud Delobelle wrote:
> It's not ideal, but you can use a decorator like this to solve this
> problem:
>
> def bindfunction(f):
> def bound_f(*args, **kwargs):
> return f(bound_f, *args, **kwargs)
> bound_f.__name__ = f.__name__
> return bound_f
Ah, very nice. Perhaps it's better to use functools.wraps?
import functools
def bindfunction(f):
@functools.wraps(f)
def bound_f(*args, **kwargs):
return f(bound_f, *args, **kwargs)
return bound_f
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list