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

Aahz aahz at pythoncraft.com
Sun Feb 9 12:17:30 EST 2003


In article <roy-57627F.12094309022003 at reader1.panix.com>,
Roy Smith  <roy at panix.com> 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.

I'd vote for IndexError, unless we permit an "else" keyword.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

Register for PyCon now!  http://www.python.org/pycon/reg.html




More information about the Python-list mailing list