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

Andrew McNamara andrewm at
Wed Feb 12 05:27:13 CET 2003

>>Piet van Oostrum wrote:
>>   ...
>> If b is a variable that takes only 0 and 1 as values then
>> b -> (x, y) is the same as
>> b -> [y, x]
>> because with boolean conditionals people are used to have the true clause
>> first. And we shouldn't change that.
>Argh -- I had missed that.  OK, then I don't like the proposal any
>more -- having to switch order of x and y depending on what
>parentheses you use would make the construct unusable IMHO, and,
>without the generality of being able to use it in the integer
>case, I don't think the usefulness is sufficient to warrant a
>new operator.  Pity:-(.

Half baked idea warning - what about:


        c -> { True: x, False: y }


        c -> { 0: x, 1: y, 2: z }

Andrew McNamara, Senior Developer, Object Craft

More information about the Python-list mailing list