"C Gillespie" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Hi,
>
> Does anyone know of any examples on how (& where) to use staticmethods and
> classmethods?

A python class method is closer to a Java static method than a python static 
method.
Class methods can be useful if you want to be able to change objects in the
class, or if you want to be able to use inheritance, neither of which python 
static
methods allow you to do cleanly.

Another, and rather esoteric use, is to use the class as its own instance.

I  find that static methods are useful when I want to import a class from
a module, and don't want to import the module itself or a lot of bits and
pieces from the module. The class gives a place to park the method, and
also lets you use inheritance, neither of which putting it into the module
does.

John Roth
>
> Thanks
>
> Colin
>
> 

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to