This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author veky
Recipients SilentGhost, alexey-muranov, rhettinger, veky
Date 2019-06-05.01:30:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1559698253.09.0.0774094806428.issue36827@roundup.psfhosted.org>
In-reply-to
Content
The point is, constructing via __new__ and initializing via __init__ are two mechanisms that aren't really orthogonal, and various heuristics are trying to guess whether the arguments you call your class with are meant for __new__ or for __init__. [Usually, immutable objects are __new__able, and mutable ones are __init__able -- and crucially, objects are usually not both. For example, list is __init__able, but tuple is __new__able.] Those heuristics assume you won't have both __init__ and __new__ implemented on your object. It mostly works if you have a hierarchy of __new__able objects, or a hierarchy of __init__able objects, but as you noticed, it usually breaks if you have an __init__able class derived from a __new__able one, or vice versa. If you're really trying for a most general solution, please note that __init__ is redundant: everything __init__ does can be done with __new__ (but not vice versa). So, you should just have a hierarchy of __new__able classes.
History
Date User Action Args
2019-06-05 01:30:53vekysetrecipients: + veky, rhettinger, SilentGhost, alexey-muranov
2019-06-05 01:30:53vekysetmessageid: <1559698253.09.0.0774094806428.issue36827@roundup.psfhosted.org>
2019-06-05 01:30:53vekylinkissue36827 messages
2019-06-05 01:30:52vekycreate