New+old-style multiple inheritance

Carl Banks pavlovevidence at gmail.com
Wed Dec 19 12:01:00 EST 2007


On Dec 19, 10:55 am, George Sakkis <george.sak... at gmail.com> wrote:
> On Dec 18, 3:16 pm, Carl Banks <pavlovevide... at gmail.com> wrote:
>
> > On Dec 18, 10:08 am, "stephen... at googlemail.com"
>
> > <stephen... at googlemail.com> wrote:
> > > We are trying to monkey-patch a third-party library that mixes new and
> > > old-style classes with multiple inheritance.
>
> > New library?  Geez, if people are dumb enough to do this, are you sure
> > you want your application to depend on their library?
>
> > Sometimes you have to work with code that's not up to your standards,
> > but come on.
>
> Doing the armchair code reviewer without context is easy but my guess
> would be that the old style library classes were written long before
> the new style ones (perhaps even before the latter were introduced)
> and/or written independently by different developers/groups, without
> any plan to mix the two in the future. Also remember that up to 2.4
> even the standard exception classes were old-style so it's not safe to
> assume that you only have new style classes to worry about when the
> very standard library includes lots of legacy code.


It's not the use of old-style classes, or even old-style and new-style
in the same package.  It's multiple inheritance combining old- and new-
style classes that's so wrong here.  They should have converted the
old-style to new when they decided to derive from both types (it's not
like that's terribly difficult).


Carl Banks



More information about the Python-list mailing list