Heiko Wundram <[EMAIL PROTECTED]> wrote: > > Am Sonntag 21 Mai 2006 22:11 schrieb Talin: > > As a general guideline, I've noticed that proposals which are purely > > syntactic sugar are unlikely to be accepted unless there is some > > additional benefit other than just compression of source code. > > I know about this, but generally, I find there's more to this "syntactic > sugar" than just source code compression. > > 1) It unifies the syntax for list comprehensions and for loops, which use the
No, it /partially unifies/ list comprehensions and for loops. To actually unify them, you would need to allow for arbitrarily nested fors and ifs... for ... in ... [if ...] [for ... in ... [if ...]]*: If I remember correctly, this was why it wasn't accepted before; because actual unification is ugly. Further, because quite literally the only difference is some indentation, a colon, and a line break, the vast majority of people would likely stick with "the one obvious way to do it", which has always worked. > 2) Just as I've replied to Terry J. Reed, if you find list comprehensions > easy > to read, you're also bound to be able to understand what "for <expr> in > <expr> if <expr>:" does, at least AFAICT. Not everyone finds list comprehensions easy to read. > 3) Generally, indentation, as Terry J. Reed suggested, isn't always good. If > the body of the loop is more than a few lines long (which happens more often > than not in my code), extra indentation is bound to confuse me. That's why I [snip] I feel for you; I really do. I've done the same thing myself. However, I don't believe that it is a good practice, in general, and I don't think that syntax should support this special case. > And, additionally, nobody's keeping me from making my own Python tree where I > can keep this patch for my very personal scripts where I don't need to have > interoperability. This is open source, isn't it? ;-) Do whatever you want. Good luck with keeping your patches current against whatever Python version you plan on using. - Josiah _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com