[Python-ideas] except expression

Ethan Furman ethan at stoneleaf.us
Wed Feb 19 21:25:12 CET 2014


On 02/19/2014 05:07 AM, Steven D'Aprano wrote:
> On Wed, Feb 19, 2014 at 10:17:05PM +1000, Nick Coghlan wrote:
>
>> I do slightly prefer that to the colon based version, although we may
>> want to go with the generator expression approach of always requiring
>> parentheses around it (with function call parentheses counting):
>>
>>      value = (lst[2] except IndexError -> 'No value')
>
> I'd be happy with that solution.

Same here.

--
~Ethan~


More information about the Python-ideas mailing list