Replace Whole Object Through Object Method
digitalorganics at gmail.com
digitalorganics at gmail.com
Mon Jun 26 14:20:16 EDT 2006
Maric Michaud wrote:
...
> > def MixInto(Class, Mixin):
> > if Mixin not in Class.__bases__:
> > Class.__bases__ += (Mixin,)
>
> This doesn't work in most cases (with new style classes), better recreat a
> type which inherit from Class and Mixin, or Class.__dict__ with
> Mixin.__dict__.
>
I think I've discovered precisely what you mean about problem with new
style classes. Do you know why it doesn't work for them? As I pointed
out, creating a new type doesn't achieve the same thing. Any
workarounds? Thanks.
More information about the Python-list
mailing list