[Python-Dev] PEP 415: Implementing PEP 409 differently (original) (raw)

Benjamin Peterson benjamin at python.org
Mon Feb 27 16:51:36 CET 2012


2012/2/26 Nick Coghlan <ncoghlan at gmail.com>:

Thanks for writing that up. I'd be amenable if the PEP was clearly updated to say that raise exc from cause would change from being syntactic sugar for ``hidden = exc; hidden.cause = cause; raise exc(as it is now) tohidden = exc; hidden.cause = cause; hidden.suppresscontext = True; raise exc``. The patch should then be implemented accordingly (including appropriate updates to the language reference).

I add the following lines to the PEP:

To summarize, raise exc from cause will be equivalent to::

exc.__cause__ = cause
exc.__suppress_context__ = cause is None
raise exc

-- Regards, Benjamin



More information about the Python-Dev mailing list