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

Andrew Koenig ark at research.att.com
Sat Feb 8 10:07:22 EST 2003


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

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

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

No, they're not the same -- because in each case the ones on the right
might evaluate x twice, and the ones on the left never do.

-- 
Andrew Koenig, ark at research.att.com, http://www.research.att.com/info/ark




More information about the Python-list mailing list