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 <rep...@bugs.python.org>
<http://bugs.python.org/issue1683368>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to