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/2012-February/116164.html below:

[Python-Dev] PEP 409 update [was: PEP 409

[Python-Dev] PEP 409 update [was: PEP 409 - final?] [Python-Dev] PEP 409 update [was: PEP 409 - final?]Ethan Furman ethan at stoneleaf.us
Fri Feb 3 17:52:08 CET 2012
Yury Selivanov wrote:
> Re "raise ValueError from ..."
> 
> So what does it mean now?  Just resetting __cause__ to make __context__ printed?

Whatever __cause__ was before (None, or an actual exception), it is now 
Ellipsis -- so __context__ will be printed and the exception chain will 
be followed.

> Can you show the down-to-earth snippet of code where such syntax would be useful?

Not sure I'll ever use it this way, but:

try:
   try:
     raise IndexError()
   except:
     raise CustomError() from None
except CustomError as e:
   # nevermind, let's see the whole thing after all
   raise e from Ellipsis

~Ethan~
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