[Python-Dev] assigning to new-style-class.__name__

Michael Hudson mwh@python.net
27 Nov 2002 13:39:37 +0000


"Samuele Pedroni" <pedronis@bluewin.ch> writes:

> > Michael Hudson <mwh@python.net> writes:
> >
> > > "Samuele Pedroni" <pedronis@bluewin.ch> writes:
> > >
> > > > I haven't looked at the code, but if it checks directly for the
> consistency of
> > > > E's mro when you change C's bases, then there is no way to move from a
> > > > hierarchy where A precedes B in the mros to one where the two are
> swapped,
> >
> > Yes there is!  With A thru E as in my previous mail:
> >
> > C.__bases__ = (A,)
> >
> > D.__bases__ = (B, A)
> >
> > C.__bases__ = (B, A)
> >
> > Now there are situations where this can probably cause difficulties,
> > but that's always going to be possible...
> 
> what about solid bases? e.g. B is list and A  simply a subclass of object.

Well, exactly.  I don't really care -- it's not like a generic "swap
the order of these bases" function is going to be terribly useful.

In that case, just setting C.__bases__ to (B,) first works, doesn't it?

Cheers,
M.

-- 
  GAG: I think this is perfectly normal behaviour for a Vogon. ...
VOGON: That is exactly what you always say.
  GAG: Well, I think that is probably perfectly normal behaviour for a
      psychiatrist. -- The Hitch-Hikers Guide to the Galaxy, Episode 9