static class methods in Python?
gmcm at hypernet.com
Fri Feb 18 04:57:54 CET 2000
Greg Wilson asks:
> Have there been any proposals to add the equivalent of "static"
> methods (belonging to the class, not to instances) to Python?
The complaints vastly outnumber the proposals.
The most common complaint is the lack of C++ style static
methods. These are usually greeted with hordes of ugly
workarounds. But the argument for is largely aesthetic, (since
a module level function serves the same purpose), and
supporting this in Python would mean some way of flagging a
function living in a class's dict as being something that should
not be bound on a getattr, (since a normal method actually
*is* a function object living in a class dict).
Then there are a few who want Smalltalk style "class
methods", which take a "self", but the "self" is the class
object, not the instance. Don Beaudry actually did this as part
of his MESS / objectmodule experiments, but they broke with
More information about the Python-list