why static methods?

Christian Tanzer tanzer at swing.co.at
Thu Feb 20 01:33:12 EST 2003


> What is the purpose of static methods? I do not understand the
> difference with a function outside the class. Can somebody point me to
> an example? The documentation[0:3] only describes behaviour, no purpose.

The difference becomes obvious once you start using classes as
first-class (sorry for the pun) citizens. If you use a class as
parameter or instance variable, a static function is accessible
through the class. A global function would not be.

-- 
Christian Tanzer                                         tanzer at swing.co.at
Glasauergasse 32                                       Tel: +43 1 876 62 36
A-1130 Vienna, Austria                                 Fax: +43 1 877 66 92






More information about the Python-list mailing list