Vedran Čačić <ved...@gmail.com> added the comment: 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.
---------- nosy: +veky _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue36827> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com