Difference between static method and a function as a class attribute?

Gonçalo Rodrigues op73418 at mail.telepac.pt
Fri Sep 6 09:58:55 EDT 2002


Hi,

What are the differences, if any, between 1 and 2?

1.
def funtest(*args):
    pass

class test(object):
    method = funtest

2.
class test(object):
    def funtest(*args):
        pass

    method = staticmethod(funtest)


And if there are any differences do they really matter, that is, does
anybody has any test cases where 1 and 2 are not interchangeable?

TIA and all the best,
Gonçalo Rodrigues



More information about the Python-list mailing list