A type error will not be selected if func has a self argument, like any other instance method.
This is because when you evaluate f.func , you actually bind f to the first argument of the function - then it becomes a private application, which you can provide with additional arguments.
If you want this to be a static method, you need a staticmethod decorator that simply discards the first parameter and passes the rest to the original function.
So, 2 ways to make it work:
def func(self): pass
- or -
Foo.func = staticmethod(func)
depending on what you are striving for.
Tom Whittock Sep 24 '10 at 23:35 2010-09-24 23:35
source share