glomde a écrit : >>We already have this (quite close to) this syntax: >> >>class <name>(super): >> <name>=<attr_value> * >> [class *] >> >>There's also the Zope3 'implements' trick, that allow to modify the >>class namespace without assignement: >> >>class <name>: >> <callable>(*args, **kw)* >> >>So what you want is very certainly doable without any syntax change. > > > It's not obvious me how you would do it it with the above syntax. > Could you give me an example? > For example how would you do: > > root = ET.Element("html") > node root: > attr head("head"): > node title("title): > for i in sections: > node section(): > attr Text = section[i] >
Your snippet doesn't follow the syntax you described. But FWIW: class Root(Node): class Head(Node): class Title(Node): content="page title" for section in sections: class Section(Node): content=section Ok. Get it. Doh :( Can't work, because we can't neither reuse the same name nor dynamically create it (or if it's possible, I fail to see how without really dirty code). Point taken. We'd need the make: statement, but the BDFL has pronounced against. I'm still -2 against your proposition, but it could make a good use case for the make statement. I gave an eye at the new 'with' statement, but I'm not sure it could be used to solve this. -- http://mail.python.org/mailman/listinfo/python-list