For review: PEP 308 - If-then-else expression
Roman Suzi
rnd at onego.ru
Sun Feb 9 13:12:26 EST 2003
On 9 Feb 2003, William Park wrote:
>
>Hey, I like this:
> (condition) -> (command1, command2)
> (int) -> [expression0, expression1, ... ]
>where '(condition)' is 'true' or 'false', and '(int)' is the usual list
>index. It flows easily.
What about extending to this:
(any_key) -> {key: value, ...}
;-)
e.g.:
def answer(x):
return x -> {-1: 'minus', 1: 'plus', 0: 'zero'}
(BTW, these are NOT usual tuple, list and dictionary.
They are evaluated on demand!)
Sincerely yours, Roman Suzi
--
rnd at onego.ru =\= My AI powered by Linux RedHat 7.3
More information about the Python-list
mailing list