@staticmethods called more than once

Skip Montanaro skip at pobox.com
Tue May 21 11:39:03 EDT 2013


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.


That is, the "@staticmethod" decorator doesn't mean, "call this function
once."

Skip
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20130521/ea59ff70/attachment.html>


More information about the Python-list mailing list