Steven D'Aprano wrote:
If it were a class method, you would call it by MyBaseClass.__new__()
rather than explicitly providing the cls argument.
But that wouldn't be any good, because the base __new__
needs to receive the actual class being instantiated,
not the class that the __new__ method
On Sun, 04 May 2014 20:03:35 +1200, Gregory Ewing wrote:
Steven D'Aprano wrote:
If it were a class method, you would call it by MyBaseClass.__new__()
rather than explicitly providing the cls argument.
But that wouldn't be any good, because the base __new__ needs to receive
the actual class
On 04/05/2014 15:16, Steven D'Aprano wrote:
On Sun, 04 May 2014 20:03:35 +1200, Gregory Ewing wrote:
Steven D'Aprano wrote:
If it were a class method, you would call it by MyBaseClass.__new__()
rather than explicitly providing the cls argument.
But that wouldn't be any good, because the
On Sun, May 4, 2014 at 8:16 AM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
On Sun, 04 May 2014 20:03:35 +1200, Gregory Ewing wrote:
Steven D'Aprano wrote:
If it were a class method, you would call it by MyBaseClass.__new__()
rather than explicitly providing the cls argument.
Hi all.
I was wandering why Python implements its __new__ method as a static
and not a class method?
__new__ always accepts a cls parameter, which lead me to believe it
was a class method. Also, implementing __new__ as a class method seems
natural when thinking about __new__ as 'a
On Sat, 03 May 2014 12:37:24 +0200, Jurko Gospodnetić wrote:
Hi all.
I was wandering why Python implements its __new__ method as a static
and not a class method?
Have you read Guido's tutorial on it?
https://www.python.org/download/releases/2.2.3/descrintro
[quote]
Factoid: __new__ is
On 5/3/2014 6:37 AM, Jurko Gospodnetić wrote:
Hi all.
I was wandering why Python implements its __new__ method as a static
and not a class method?
For a technical internal reason that Guido and maybe others have
explained on pydev (more than once). I forget the details partly because
Steven D'Aprano wrote:
I'm not entirely sure what he means by upcalls, but I believe it means
to call the method further up (that is, closer to the base) of the
inheritance tree.
I think it means this:
def __new__(cls):
MyBaseClass.__new__(cls)
which wouldn't work with a class
On Sun, 04 May 2014 11:21:53 +1200, Gregory Ewing wrote:
Steven D'Aprano wrote:
I'm not entirely sure what he means by upcalls, but I believe it
means to call the method further up (that is, closer to the base) of
the inheritance tree.
I think it means this:
def __new__(cls):