Proposal for new operators to python that add syntactic sugar for hierarcical data.

glomde tbrkic at yahoo.com
Thu May 18 14:01:15 EDT 2006


> What you are trying to achieve is to make syntactic sugar for making namespace
> definitions look nicer. But: the way you are trying to do so isn't pythonic,
> because there isn't one obvious way how your proposal works; you're not even
> specifying a proper semantic interpretation of your syntax (and use "magic"
> markers, which is even more a NoNo).
I used 'magic' markers, since I am lousy at coming up with new
keywords....

>
> For a better thought out proposal (IMHO) for stacking and defining namespaces
> (based on the current metaclass behaviour), look for the PEP on the "make"
> keyword (which was sent to Py-Dev some weeks ago).

It might be that my proposal the same as the 'make' pep but not so
general...
But I'll try to formalize it a little bit more.

I am proposing two new keywords 'node' and 'attr'. Which have the
syntax:

node [callable|name][:]

This will append itself to the current node if it is a callable. If it
is a name it
will become the new current node. The current node has the scope of the
block
or until a new node is created.

attr name = expression
This will set the attribute name to expression on the current node.

I dont think it is the same as the  'make' but I wouldnt rule it
out.....




More information about the Python-list mailing list