i I would like to extend python so that you could create hiercical tree structures (XML, HTML etc) easier and that resulting code would be more readable than how you write today with packages like elementtree and xist. I dont want to replace the packages but the packages could be used with the new operators and the resulting IMHO is much more readable.
The syntax i would like is something like the below: # Example creating html tree '*!*' is an operator that creates an new node, '*=*' is an operator that sets an attribute. So if you take an example to build a smalle web page and compare with how it looks with in element tree now and how it would look like when the abover operators would exist. 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!" 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!" I think that with the added syntax you get better view of the html page. Repeating things dissapears and you get indentation that corresponds to the tree. I think it is very pythonic IMHO. It could be done quite generic. If the variable, object after '*!*' must support append method and if you use '*=*' it must support __setitem__ Any comments? -- http://mail.python.org/mailman/listinfo/python-list