Re: Foo.__new__ is what species of method?

2015-07-13 Thread Stefan Behnel
Steven D'Aprano schrieb am 14.07.2015 um 06:54: > On Tuesday 14 July 2015 14:45, Ben Finney wrote: >> The Python reference says of a class ‘__new__’ method:: >> >> object.__new__(cls[, ...]) >> >> Called to create a new instance of class cls. __new__() is a static >> method (special-cas

Re: Foo.__new__ is what species of method?

2015-07-13 Thread Ben Finney
Steven D'Aprano writes: > py> class Spam(object): > ... def __new__(cls): > ... print cls > ... > py> Spam.__new__() # implicit first arg? > Traceback (most recent call last): > File "", line 1, in > TypeError: __new__() takes exactly 1 argument (0 given) Thanks, I'm glad I

Re: Foo.__new__ is what species of method?

2015-07-13 Thread Steven D'Aprano
On Tuesday 14 July 2015 14:45, Ben Finney wrote: > Howdy all, > > The Python reference says of a class ‘__new__’ method:: > > object.__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

Foo.__new__ is what species of method?

2015-07-13 Thread Ben Finney
Howdy all, The Python reference says of a class ‘__new__’ method:: object.__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 i