Making a decorator a staticmethod

Bruno Desthuilliers bdesth.quelquechose at free.quelquepart.fr
Thu Jan 8 13:02:45 EST 2009


Zac Burns a écrit :
> I have a decorator in a class

Why ?

(snip)
> The exception that I get when using it as a staticmethod and try to
> use it in the baseclass is "TypeError: 'staticmethod' object is not
> callable".
> When it is not staticmethod the exception I get in the extension class
> is is "TypeError: unbound method decorateTest() must be called with C
> instance as first argument (got function instance instead)"

Just make it a plain function and you'll be fine.




More information about the Python-list mailing list