For review: PEP 308 - If-then-else expression

François Pinard pinard at
Sat Feb 8 16:05:35 CET 2003

[Tim Peters]

> Just noting that if the proposal is accepted, we can get rid of those pesky
> "and" and "or" operators:

>     x and y    same_as    y if x else x
>     x or y     same_as    x if x else y

> Removing two things each time a new one is added is an effective way to keep
> the language small <wink>.

x and/or y may be complex denotations, in which case the `if-else' writing
could be cumbersome by comparison.

This is a bit like rewriting `a += 1' into `a = a + 1', which hurts when `a'
is not a simple denotation.

François Pinard

More information about the Python-list mailing list