A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2014-February/132633.html below:

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

[Python-Dev] PEP 463: Exception-catching expressions [Python-Dev] PEP 463: Exception-catching expressionsGlenn Linderman v+python at g.nevcal.com
Sat Feb 22 03:08:22 CET 2014
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))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20140221/5c2f532b/attachment.html>
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4