On Fri, Sep 13, 2002, Guido van Rossum wrote:
Aahz:
I'm curious, and I don't recall having seen anything about this: why wouldn't we simply use attributes to hold this information, like __slots__? After all, attributes get inherited, too, and there's no need to pretzel the syntax. Using attributes IMO would make it easier to handle the case where derived classes need to mangle type and interface declarations.
That's exactly what Zope does with the __inherits__ attribute.
But it's got limitations: there's only one __inherits__ attribute, so it isn't automatically merged properly on multiple inheritance, and adding one new interface to it means you have to copy or reference the base class __inherits__ attribute.
Isn't that what metaclasses are for? -- Aahz (aahz@pythoncraft.com) <*> http://www.pythoncraft.com/ Project Vote Smart: http://www.vote-smart.org/