[Python-Dev] metaclass insanity (original) (raw)
Guido van Rossum guido@python.org
Tue, 05 Nov 2002 10:03:51 -0500
- Previous message: [Python-Dev] metaclass insanity
- Next message: [Python-Dev] metaclass insanity
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> Can someone provide a reason why you'd want to use nested classes? > I've never felt this need myself. What are the motivations?
XIST (http://www.livinglogic.de/Python/xist/) uses nested classes to map XML element types and their attributes to Python classes. For example the HTML element type img looks like this in XIST: class img(Element): class Attrs(Element.Attrs): class src(URLAttr): required = True class alt(TextAttr): required = True class align(TextAttr): values = ("top", "middle", ...)
That's cool.
--Guido van Rossum (home page: http://www.python.org/~guido/)
- Previous message: [Python-Dev] metaclass insanity
- Next message: [Python-Dev] metaclass insanity
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]