For review: PEP 308 - If-then-else expression
Alex Martelli
aleax at aleax.it
Sun Feb 9 12:20:44 EST 2003
Roy Smith wrote:
> Alex Martelli <aleax at aleax.it> wrote:
>> I particularly like the generalization to an int on the LHS of the
>> new proposed -> operator.
>
> What happens in the integer version if the index is out of bounds for
> the list of code fragments? Do you get some default, or do you raise
> IndexError? Or maybe it just returns None? I could see arguments in
> favor of any of these.
Personally, I would prefer an exception -- that's what I would
expect, "pythonically", just as if the LHS was "indexing" the RHS's.
Alex
More information about the Python-list
mailing list