On 11/19/08, Alan Gauld <[EMAIL PROTECTED]> wrote: > "spir" <[EMAIL PROTECTED]> wrote > >> I have not yet found any use for this feature. > > Which makes it very different to an instance method. instance > methods act on instances. class methods act on the entire > class - ie they can affect all of the instances or none. > > You don't need to use class methods(or statics) very often > but when you do they are invaluable.
the good news is that all of these fancy features are *optional*. if you don't know what they're useful for, that probably means you don't need them yet, so no need to stress that you *have* to learn what they are as you're learning the language. at some point, you'll come across a situation where you *wished* that Python had some feature you wanted, like a function used only in relation to a class or its instances but don't want to define it as an external function (@staticmethod) or to have a method where the class object itself is passed in for you to be able to modify a class value global to all instances (@classmethod), and to discover that features *are* there! cheers, -- wesley - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "Core Python Programming", Prentice Hall, (c)2007,2001 "Python Fundamentals", Prentice Hall, (c)2009 http://corepython.com wesley.j.chun :: wescpy-at-gmail.com python training and technical consulting cyberweb.consulting : silicon valley, ca http://cyberwebconsulting.com _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor