TypeError: unbound method DefaultTracer() must be called with MyClass instance as first argument (got str instance instead)
__peter__ at web.de
Thu Jul 7 14:50:33 CEST 2011
Peter Otten wrote:
> or you wrap the callable in a descriptor:
>>>> def DefaultTracer(*args): print args
>>>> class D(object):
> ... def __init__(self, f):
> ... self.f = f
> ... def __get__(self, *args):
> ... return self.f
After skimming over Steven's post: use staticmethod.
No idea why I didn't think of that myself.
More information about the Python-list