PEP 308: Alternative conditional operator forms

Erik Max Francis max at alcyone.com
Tue Feb 11 19:21:11 EST 2003


Robin Munn wrote:

> List comprehensions are required to be enclosed by punctuation pairs,
> even though it would be possible to parse them without those enclosing
> brackets (the presence of "for" after an expression being what would
> trigger the parser that this is a list comprehension).

But it makes a lot more sense for list comrpehensions, because 1. list
comprehensions are a very unique syntax and 2. the result of a list
comprehension _is_ a list, so it actually makes sense for it to be
enclosed in square brackets.

I'm not saying I'm frighteningly opposed to requiring parentheses, I'm
just saying I don't think it's necessary.  In practice, I suspect I
would probably _use_ parentheses most of them I'd use a conditoinal
operator, just as I do when I use the ?: operator in C, C++, Java, or
(not that I write it anymore) Perl.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ Being in love for real / It ain't like a movie screen
\__/ India Arie
    Bosskey.net: Aliens vs. Predator 2 / http://www.bosskey.net/avp2/
 A personal guide to Aliens vs. Predator 2.




More information about the Python-list mailing list