[Info] PEP 308 accepted - new conditional expressions
Ron Adam
rrr at ronadam.com
Sat Oct 1 11:21:03 EDT 2005
Reinhold Birkenfeld wrote:
> Ron Adam
>>I think I'm going to make it a habit to put parentheses around these
>>things just as if they were required.
> Yes, that's the best way to make it readable and understandable.
>
> Reinhold
Now that the syntax is settled, I wonder if further discussion on the
contextual behavior could be done? Or maybe it was already done off
line or in private email?
To me the advantage of a if b else c form is the easy chaining to build
up a sum of conditional parts, where each next part is dependent on the
previous result.
The advantage of the nested form, is it can be used in place of an
if-elif-else structure. But I think the (a if b else c) syntax doesn't
match that behavior very well so I was expecting the default behavior to
be the sequential chaining and not nested evaluation.
But of course, by explicitly placing parentheses, you can do either.
<Shrug>
Cheers,
Ron
More information about the Python-list
mailing list