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

glomde tbrkic at yahoo.com
Thu May 18 12:00:49 CEST 2006


> You also repeat yourself:  head("head"), title("title"), body("body")
>
> What about this:
>
> # build a tree structure
> root = ET.Element("html")
> !root
>     !head
>         !title
> if A is True:
>             &text = "Page A"
> else:
>             &text = "Page B"
>     !body
>         &bgcolor = "#ffffff"
>         &text = "Hello, World!"
>
>

Yes this is how it should be. But It depends on which package would be
used. If you used xist it would look like that since they have one
class for each html tag. I really propose
a generic solution that any package that support the method append and
__settiem__
could use the new syntax.

But minor isssues but it would look something like this with xist:

 !root
    !head():
        !title():
            if A is True:
                &text = "Page A"
            else:
                &text = "Page B"
        !body()
               &bgcolor = "#ffffff"
               &text = "Hello, World!"



> mmm...yamlthon? yython...:-)
Guess what I have for suffix on the files before preprocessing?
....pyml ofcourse.




More information about the Python-list mailing list