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

glomde tbrkic at yahoo.com
Thu May 18 09:17:06 EDT 2006


> What about writing a mini-language that gets translated to Python? Think of
> Cheetah, which does exactly this (albeit not being limited to templating HTML
> data).
I have implemented  my proposal as preprocessor. And it works fine. But
my
proposal in not only for HTML it can be used for all hieracical data.
Example:

  myList = []
  *+* myList:
        *+* []:
         for i in range(10):
              *+* i
         *+* {}:
             for i in range(10):
                 *=* i = i
 Which should create myList = [[0..9], {0:0, ... 9:9}]

So it adds the power of for loops etc when creating data structures.
ANY datastructure.

 > nothing general the OP is trying to achieve here
Define general :-). I do think I solve something and make it more
readable.
You could also argue that list comprehension doesnt solve anything
general.

> By the way: the language you (the OP) are trying to implement here goes
> strictly against the MVC model of application programming. You know that,
> right?

???. I cant see how this breaks MVC. MVC depends on how you parition
your application
this doesnt put any constraint on how you should do your application.




More information about the Python-list mailing list