PEP-308 a "simplicity-first" alternative
Tony Lownds
tony-clpy at lownds.com
Wed Feb 12 04:16:49 EST 2003
holger krekel <pyth at devel.trillke.net> wrote in message news:<mailman.1045011836.2867.python-list at python.org>...
>
> and_test: not_test ('and' not_test ['else' not_test])*
>
So its a ternary operator not two binary operators.
I could like that syntax, over time. Nobody would guess this, no
matter what thier background. I think newcomers might squint at it
too. On the other hand, it "fixes the idiom" quite well, changing x
and y or z --> x and y else z is just a small change. It's also
nice that the "else" bit is usefully removable.
The if x: y else: x syntax still doesn't read like an expression for
me, probably because it doesn;t look like an operator. Whether the
"else" has a colon or not seems forgettable. But its pretty readable.
I'm +0 on either of those syntaxes, but I'm still +1 on ?: Its
readable by anyone knowledgable in C, C++, Java, Javascript, Ruby,
Perl, PHP, and the list goes on. I think it will be easy to remember
and explain too. And concise. Most of all, it visually parses the best
for me.
-Tony
More information about the Python-list
mailing list