Message219278
> 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. |
|
Date |
User |
Action |
Args |
2014-05-28 15:39:11 | eric.snow | set | recipients:
+ eric.snow, gvanrossum, georg.brandl, rhettinger, terry.reedy, gregory.p.smith, jcea, jaraco, Rhamphoryncus, blakeross, benjamin.peterson, KayEss, jonash |
2014-05-28 15:39:11 | eric.snow | link | issue1683368 messages |
2014-05-28 15:39:10 | eric.snow | create | |
|