[Python-Dev] metaclass insanity
Guido van Rossum
guido@python.org
Wed, 30 Oct 2002 15:44:38 -0500
> > The best thing to do would perhaps to make __mro__ assignable, but
> > with a check that ensures the above constraint. I think I'd take a
> > patch for that.
>
> Shouldn't be too hard.
>
> > I'd also take a patch for assignable __bases__. Note that there are
> > constraints between __bases__ and __base__.
>
> Should assigning to __bases__ automatically tweak __mro__ and
> __base__? Guess so.
Yes. Note that changing __base__ should not be done lightly --
basically, the old and new base must be layout compatible, exactly
like for assignment to __class__.
> What would assigning to __base__ do in isolation?
> Perhaps that shouldn't be writeable.
Perhaps it could be writable when __bases__ is a 1-tuple. But it's
fine if it's not writable.
> > I'd also take a patch for assignable __name__.
>
> This is practically a one-liner, isn't it? Not hard, anyway.
Probably. Can't remember why I didn't do it earlier.
> And there was me wondering what I was going to do this evening.
I don't have that problem -- a Zope customer problem was waiting for
me today. :-(
--Guido van Rossum (home page: http://www.python.org/~guido/)