[Python-Dev] metaclass insanity (original) (raw)
Michael Hudson mwh@python.net
30 Oct 2002 18:17:26 +0000
- Previous message: [Python-Dev] metaclass insanity
- Next message: [Python-Dev] metaclass insanity
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Guido van Rossum <guido@python.org> writes:
> I guess one way of doing this would be to reimplement mro resolution > and so on in Python, which would be annoying and inefficient. Hmm.
Alas, yes. You'd have to be able to write a class's tpmro slot (corresponding to the mro attribute), but there's no way to do that in Python, because it is too easy to cause mistakes. E.g. all C code that currently uses tpmro assumes that it is a tuple whose items are either types or classic classes. 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. What would assigning to base do in isolation? Perhaps that shouldn't be writeable.
I'd also take a patch for assignable name.
This is practically a one-liner, isn't it? Not hard, anyway.
And there was me wondering what I was going to do this evening.
Cheers, M.
-- Now this is what I don't get. Nobody said absolutely anything bad about anything. Yet it is always possible to just pull random flames out of ones ass. -- http://www.advogato.org/person/vicious/diary.html?start=60
- Previous message: [Python-Dev] metaclass insanity
- Next message: [Python-Dev] metaclass insanity
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]