Dynamically Changing the Base Class

Adam C. adamc55 at gmail.com
Tue Jul 8 21:52:52 EDT 2008


On Jul 7, 10:44 pm, Michele Simionato <michele.simion... at gmail.com>
wrote:
> On Jul 7, 8:08 pm, "Adam C." <adam... at gmail.com> wrote:
>
> > Thanks. I think we would want new-style classes, and 6-year-old
> > patches strike me as maybe a little out of the desired path... so this
> > really just doesn't work in modern Python?
>
> Can you use (multiple) inheritance instead of changing the bases?
> Alternatively, try using an old-style class, changing the bases
> and subclassing it inheriting from object too:
>
> class NewStyle(OldStyle, object):
>   pass

Definitely don't want old-style classes. We could probably use
multiple inheritance, but it feels like a horrible hack to me; I'd
just go with duck typing and alternate implementations over that.



More information about the Python-list mailing list