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

Alex Martelli aleax at aleax.it
Mon Feb 10 03:26:37 EST 2003


Anthony Baxter wrote:
   ...
>> We could then also have one for ints rather than bools:
>> 
>>         i -> [ v_0, v_1, v_2, ... ]
>> which would pick v_i and evaluate that.
> 
> On the other hand, I don't like this. If you need to do something like
> this, why not just
> 
>           [ v_0, v_1, v_2, ... ][i]  ?

Indexing isn't lazy: all the sub-expressions would be evaluated
first -- no "short-circuiting".  The -> idea would evaluate only
the i'th sub-expression.


Alex





More information about the Python-list mailing list