"Huy Ton That" <[email protected]> wrote

class WhatFor(object):
   def it(cls):
       print 'work with %s' % cls
   it = classmethod(it)
   def uncommon():
       print 'I could be a global function'
   uncommon = staticmethod(uncommon)

But I can't seem to understand the above. Under what circumstance would staticmethod be useful? I am just deriving that you are not passing self.

I think static methjods are largely a mistake of history. ISTR They were introduced into python before class methods (not by much - one release?) and to support backward compatibility they stayed. In practice classmethod
will be a better choice.

IMHO at least :-)

--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/


_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to