[issue1683368] object.__init__ shouldn't allow args/kwds
Eric Snow
report at bugs.python.org
Wed May 28 17:39:11 CEST 2014
Eric Snow added the comment:
> If you don't know enough about the base class you shouldn't be subclassing it.
That's important when overriding any API in subclass and absolutely
always essential when it comes to __new__ and __init__! That's
something that isn't very obvious at first. :(
> In this particular case you should be overriding __init__, not __new__.
Jason's code is doing something like OSError.__new__ does now, which
returns an instance of a subclass depending on the errno. However,
while the language supports it, I see that as a viable hack only when
backward-compatibilty is a big concern. Otherwise I find factory
classmethods to be a much better solution for discoverability and
clarity of implementation.
----------
nosy: +eric.snow
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1683368>
_______________________________________
More information about the Python-bugs-list
mailing list