Message217819
Thanks for the detailed response! :-(
I should have tested more before reporting the issue.
Sorry for the noise. :-(
I saw the 'cls' argument and assumed it was a class
method. Having to explicitly specify cls did not
seem to be in contradiction with this since I assumed
__new__ is generally invoked on the class directly.
I still do not see why it had to be a static method
and has not been implemented as a class method, but I
guess I'll better ask that kind of a question on the
python user's newsgroup. :-)
Just in case it can help someone else, here's some
sample code what convinced me __new__ was indeed
implemented as a static method:
> class X:
> pass
> X.__new__() # TypeError: object.__new__(): not enough arguments
> X.__new__(X) # creates a new X instance
> x = X()
> x.__new__() # TypeError: object.__new__(): not enough arguments
> x.__new__(X) # creates a new X instance
If __new__ had been a class method then calling
'x.__new__()' would have worked as well.
Thanks again for the replies!
Best regards,
Jurko Gospodnetić |
|
Date |
User |
Action |
Args |
2014-05-03 09:11:13 | Jurko.Gospodnetić | set | recipients:
+ Jurko.Gospodnetić, steven.daprano, docs@python, eryksun |
2014-05-03 09:11:13 | Jurko.Gospodnetić | set | messageid: <1399108273.26.0.566337008237.issue21415@psf.upfronthosting.co.za> |
2014-05-03 09:11:13 | Jurko.Gospodnetić | link | issue21415 messages |
2014-05-03 09:11:12 | Jurko.Gospodnetić | create | |
|