[Python-ideas] except expression

spir denis.spir at gmail.com
Thu Feb 13 19:47:05 CET 2014


On 02/13/2014 07:43 PM, Amber Yust wrote:
> Actually. What if we just reused 'try'?
>
>      foo = bar() except BazException try 'qux'
>
> This also leads naturally to chaining multiple possible fallbacks:
>
>      foo = bar() except BarException try baz() except BazException try None

I like it. Especially because 'try' already works with 'except'. (But note that 
'try', like my proposal of 'then', normally introduces a block).

d


More information about the Python-ideas mailing list