On 22 February 2014 10:29, Greg Ewing <[email protected]> wrote:

> Antoine Pitrou wrote:
>
>     lst = [1, 2]
>>>    value = lst[2] except IndexError: "No value"
>>>
>>
>> the gain in concision is counterbalanced by a loss in
>> readability,
>>
>
> This version might be more readable:
>
>    value = lst[2] except "No value" if IndexError
>

+1 - it's readable, clear, and only uses existing keywords.

Tim Delaney
_______________________________________________
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to