New+old-style multiple inheritance

Carl Banks pavlovevidence at gmail.com
Tue Dec 18 15:25:16 EST 2007


On Dec 18, 2:09 pm, Jonathan Gardner
<jgardner.jonathangardner.... at gmail.com> wrote:
> On Dec 18, 7: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.  In so doing we have
> > uncovered some unexpected behaviour:
>
> <snip>
>
> > I know this level of messing with python internals is a bit risky but
> > I'm wondering why the above code doesn't work.
>
> You've already discovered why--you're mixing old and new style
> classes.
>
> Monkey patching is definitely unpythonic. You must be a Ruby guy. Why
> don't you try doing something else to get the behavior you want,
> something more explicit?

Time and place.

A well-considered, timely monkey-patch can sometimes save all kinds of
workarounds and other headaches.


Carl Banks



More information about the Python-list mailing list