maser wrote:
> Thanks, Andreas. Why do we need to use classmethod/
> staticmethod and where do we need to use them ?

I use staticmethods as a convenience to put related functions in the 
namespace of a class. Perhaps foo.py contains class Foo with 
staticmethod bar(). In client code I can say

from foo import Foo
Foo.bar()

If bar was a module method it would be

from foo import Foo, bar
bar()


I prefer the former in cases where bar is related to Foo.

Kent
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to