For review: PEP 308 - If-then-else expression
Dan Bishop
danb_83 at yahoo.com
Sat Feb 8 12:40:31 EST 2003
"Tim Peters" <tim_one at email.msn.com> wrote in message news:<mailman.1044697041.30758.python-list at python.org>...
> 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
And instead of writing
days = 365 + (year % 4 == 0 and (year % 100 != 0 or year % 400 == 0))
we'll have to write.
days = 365 + (0 if year % 4 else 1 if year % 100 else year % 400 == 0)
> Removing two things each time a new one is added is an effective way to keep
> the language small <wink>.
Fortunately, it could never happen.
More information about the Python-list
mailing list