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

glomde tbrkic at yahoo.com
Thu May 18 13:14:05 EDT 2006


I'm answering two of you posts here...

> 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....

My code was  just to show that the proposal is not only for HTML
generation but could be used whenever you want to create COMPLEX
hierarcical datastructures.
In the above example I would of course use what you wrote.

Do I need to show you a example where you cant use the style you
showed?

> Strange enough, working with trees is nothing new, and it seems that
> almost anyone managed to get by without cryptic 'operators' stuff.
Strange enough once almost anyone managed to get by without Python...
:-)

> > I used HTML as example since it is a good
> > example and
> > most people would understand the intention.
>
>Sorry for being dumb.
It not your fault :-)

> > But could you elaborate on your comment that it is unusable.
>
> Ask all the coders that switched from Perl to Python why they did so...

You seem to really have a thing for Perl...

>From what you written I assume you mean that it is no good because you
find the syntax cryptic. For me cryptic is for example how you in Perl
create list of lists, ie
it takes a while to understand and when you havent done in a while
youyou have to relearn it. Python has a few of those aswell... but you
really
only need them when doing something cryptic...

IMO what I propose isnt cryptic, because of
  * I think after it has been explained it is no problem to understand
how it works.
  * It doesnt have strange sideeffects
  * Doesnt break any old code.
  * You dont have to relearn if you havent done it a while.

Also if you never would have seen such code before, I think you would
understand
what is meant and even be able to modify it.




More information about the Python-list mailing list