[Python-checkins] peps: give equivalent code for raise from

benjamin.peterson python-checkins at python.org
Mon Feb 27 16:51:14 CET 2012


http://hg.python.org/peps/rev/e83741848e9e
changeset:   4090:e83741848e9e
user:        Benjamin Peterson <benjamin at python.org>
date:        Mon Feb 27 10:51:11 2012 -0500
summary:
  give equivalent code for raise from

files:
  pep-0415.txt |  6 ++++++
  1 files changed, 6 insertions(+), 0 deletions(-)


diff --git a/pep-0415.txt b/pep-0415.txt
--- a/pep-0415.txt
+++ b/pep-0415.txt
@@ -50,6 +50,12 @@
 There is precedence for ``__suppress_context__`` with the
 ``print_line_and_file`` exception attribute.
 
+To summarize, ``raise exc from cause`` will be equivalent to::
+
+    exc.__cause__ = cause
+    exc.__suppress_context__ = cause is None
+    raise exc
+
 Patches
 =======
 

-- 
Repository URL: http://hg.python.org/peps


More information about the Python-checkins mailing list