deprecated - Python Deprecation Warnings with Monostate __new__ -- Can someone explain why? -
I have an original monostrate with Python 2.6.
class borg (object): __shared_state = {} def __new__ (cls, * args, ** kwargs): self = object.__ new__ (cls, * args, ** kwargs) Self .__ dict__ = cls .__ share_state return self def __init __ (self, * args, ** ("report report", "base report") contacts = kwargs.get ("contact", none) a = borg (I'm happy that I have been given the following warning.
Untitled: 4: Sanctuary warning: object .__ new__ () no criteria It does not take the self = object .__ new__ (CLS, * AGR, ** quad)
After a little bit of Goggling I know that connected. I do not know what that means It is complaining about the following line
self = object.__ new__ (CLS, ARG, ** quad)
Which looks fine. Can anyone explain in terms of lamins that why this problem is what I think is "this is the other Is inconsistent with Tins, such as a list "but I'm not sure why I feel sure what it will shown me the right way of doing it?
Thanks
See singleton (object):
__ new__ dislikes
question was:
Message means what it says . :-) There is no point in calling the object .__ new (__) is more than a square parameter, and any code that was dumping it into black hole.
The only time when this makes sense for the object .__ new (__) to ignore additional arguments, when it is not being overridden, but __init is is being overridden - then you have a completely default __new__ and the investigation of constructor arguments is run in __IN__. / P>
The purpose of all this is to catch the error in an object like the call (42) which again passes a logic that is not used. This is often a bug in your program.
- Guido
Comments
Post a Comment