What to use for adding syntax for hierarcical trees, metaclasses, tokenize.py or PLY?
glomde
tbrkic at yahoo.com
Tue May 9 18:03:24 EDT 2006
Thanks,
but the thing is that I want to have the syntactical sugar.
And I think that you could use elementtree or xist or any
other python tree structure module at the bottom. It could
be quite generic.
And with the syntactical sugar I find it a lot more readable.
A little bit like yaml, but you have the power of python aswell.
For example with syntactical sugar:
# build a tree structure
root = ET.Element("html")
*!*root:
*!*head("head"):
*!*title("title):
*=*text = "Page Title"
*!*body("body"):
*=*bgcolor = "#ffffff"
*=*text = "Hello, World!"
This would then be this with element tree package.
# build a tree structure
root = ET.Element("html")
head = ET.SubElement(root, "head")
title = ET.SubElement(head, "title")
title.text = "Page Title"
body = ET.SubElement(root, "body")
body.set("bgcolor", "#ffffff")
body.text = "Hello, World!"
I find it a lot more readable with the syntactical sugar.
So I would really like to add this syntax.
/T
More information about the Python-list
mailing list