@staticmethods called more than once

88888 Dihedral dihedral88888 at googlemail.com
Tue May 21 21:23:14 EDT 2013


Ethan Furman於 2013年5月22日星期三UTC+8上午12時30分22秒寫道:
> On 05/21/2013 08:39 AM, Skip Montanaro wrote:
> 
> > Don't confuse the use of "static" in Python with its use in C/C++.  From a post on StackOverflow:
> 
> >
> 
> >     A staticmethod is a method that knows nothing about the class or instance it was called on. It just gets the
> 
> >     arguments that were passed, no implicit first argument. It is basically useless in Python -- you can just use a
> 
> >     module function instead of a staticmethod.
> 
> 
> 
> For there record, staticmethod is useful when you want to make it possible for subclasses to change behavior.
> 
> 
> 
> --
> 
> ~Ethan~

I prefer objects in classes with slimer figures not heavily weighted
with trivial methods in each instance construction and clone.

 But this is only my personal style of classes in python.



More information about the Python-list mailing list