a new object definition

Steven Bethard steven.bethard at gmail.com
Wed Sep 6 15:31:59 EDT 2006


Sylvain Ferriol wrote:
> with the 'make' syntax, it will be really easy to translate a program or 
> a data structure defined in XML format into python syntax.

Only if there are no ordering constraints and no need for multiple 
elements with the same name.  The make statement was built to mirror the 
the class statement, so the body is just executed in a regular Python 
dict.  Hence, you can only have one value for each name, and the order 
in which the names appear is not maintained.  There's some discussion of 
workarounds_ for this in the PEP, but they're pretty hackish.

.. _workarounds: 
http://www.python.org/dev/peps/pep-0359/#customizing-the-dict-in-which-the-block-is-executed

STeVe



More information about the Python-list mailing list