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

bruno at modulix onurb at xiludom.gro
Thu May 18 09:47:21 EDT 2006


glomde wrote:
>>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

Nor is Cheetah. Nor is Django's templating system. Nor are some other
Python templating systems.

> it can be used for all hieracical data.
> Example:
> 
>   myList = []
>   *+* myList:
>         *+* []:
>          for i in range(10):
>               *+* i
>          *+* {}:
>              for i in range(10):
>                  *=* i = i

Sweet Lord, have mercy !

>  Which should create myList = [[0..9], {0:0, ... 9:9}]

myList = [
  range(10),
  dict((i, i) for i in range(10))
]

Let's talk about readability....

> I do think I solve something and make it more
> readable.

Lol. Any Perl coder around ?

-- 
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"



More information about the Python-list mailing list