Steven D'Aprano steve at
Sat Jan 27 06:39:17 CET 2007

On Fri, 26 Jan 2007 20:27:29 -0800, Michele Simionato wrote:

> On Jan 22, 2:58 am, "Gert Cuykens" <gert.cuyk... at> wrote:
> There is a factual mistake on that reference. The last sentence
>> One final note: the single most common use for classmethod is probably
>> in overriding __new__(). It is always needed when overriding __new__()
>> because __new__() is a classmethod.
> is wrong, since __new__ is a staticmethod, NOT a classmethod.

There's a contradiction in the Python docs. 

>From we see:

"A class method receives the class as implicit first argument, just like
an instance method receives the instance."


"A static method does not receive an implicit first argument."

But from we read:

"__new__(cls[, ...])
    Called to create a new instance of class cls. __new__() is a static
    method (special-cased so you need not declare it as such) that takes
    the class of which an instance was requested as its first argument.
    The remaining arguments are those passed to the object constructor
    expression (the call to the class)."

It seems that the description of __new__ is wrong. Since __new__ takes an
implicit first argument, the class, it is a class method, not a static


More information about the Python-list mailing list