Re: [Python-Dev] PEP 463: Exception-catching expressions

2014年2月21日 18:10:25 -0800

On 2/21/2014 5:06 PM, Jan Kaliszewski wrote:
Or even (still being my favorite):
msg = seq[i] except (IndexError: "nothing")
This syntax actually has a benefit: the parenthesized syntax after except could become a list, to allow handling different exceptions from the tried expression with different results: msg = seq[dictionary[i]] except (IndexError: "nothing", KeyError: "serious problems")
And still allows nesting:
msg = seq[i] except (IndexError: dictionary[i] except (KeyError: "no fallback data for %s" % i))
_______________________________________________
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