[Tutor] classmethod, staticmethod functions (decorator related)
Huy Ton That
huyslogic at gmail.com
Fri Sep 10 16:35:48 CEST 2010
I am reading the decorator section within Expert Python Programming and I am
very confused in the first example, of a method that was done before
decorators. It reads:
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100910/c7ae38a3/attachment.html>
More information about the Tutor
mailing list