[Python-Dev] metaclass insanity (original) (raw)
Guido van Rossum guido@python.org
Thu, 31 Oct 2002 13:58:00 -0500
- Previous message: [Python-Dev] metaclass insanity
- Next message: [Python-Dev] Re: Incorporating bsddb3
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> > 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.
OK. I can crib code from typesetclass, I guess. Or one could just allow assignment to bases when base doesn't change? base is object for the majority of new-style classes, isn't it?
But if you derive from a builtin type (e.g. list or dict), base will be that.
Brr. There's a lot I don't know about post 2.2 typeobject.c.
Me too. :-)
> > 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.
Don't see the point of that. > But it's fine if it's not writable. Easier :)
Agreed.
> > > 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.
It's a bit more complicated than that. What's the deal wrt. dots in tpname? Is there any way for a user defined class to end up called "something.somthingelse"?
I hope not. The dots are for extensions living inside a package; everything before the last dot ends up as module.
Oh, and while we're at it, here's a bogosity:
>>> class C(object): ... pass ... >>> C.module 'main' >>> C.module = 1 >>> C.module Traceback (most recent call last): File "", line 1, in ? AttributeError: module caused by lax testing in typesetmodule.
Oops. Can you fix it? Or are there complications? Seems to be broken in 2.2 too.
> > 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. :-(
Well, I didn't get it finished either. Fiddly, this stuff. Maybe by tomorrow.
Great!
I'll be offline Friday through Monday -- going to a weekend conference.
--Guido van Rossum (home page: http://www.python.org/~guido/)
- Previous message: [Python-Dev] metaclass insanity
- Next message: [Python-Dev] Re: Incorporating bsddb3
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]