@staticmethods called more than once

Ethan Furman ethan at stoneleaf.us
Tue May 21 12:30:22 EDT 2013


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~



More information about the Python-list mailing list