[Python-checkins] r70383 - peps/trunk/pep-0377.txt

nick.coghlan python-checkins at python.org
Sun Mar 15 13:47:03 CET 2009


Author: nick.coghlan
Date: Sun Mar 15 13:47:03 2009
New Revision: 70383

Log:
Change abstract to avoid the implication that the problem is specific to contextlib.nested

Modified:
   peps/trunk/pep-0377.txt

Modified: peps/trunk/pep-0377.txt
==============================================================================
--- peps/trunk/pep-0377.txt	(original)
+++ peps/trunk/pep-0377.txt	Sun Mar 15 13:47:03 2009
@@ -16,9 +16,13 @@
 
 This PEP proposes a backwards compatible mechanism that allows ``__enter__()``
 methods to skip the body of the associated ``with`` statment. The lack of
-this ability currently means the ``contextlib.nested`` context manager
-is unable to fulfil its specification of being equivalent to writing out
-multiple nested ``with`` statements [1].
+this ability currently means the ``contextlib.contextmanager`` decorator
+is unable to fulfil its specification of being able to turn arbitrary
+code into a context manager by moving it into a generator function
+with a yield in the appropriate location. One symptom of this is that
+``contextlib.nested`` will currently raise ``RuntimeError`` in
+situations where writing out the corresponding nested ``with``
+statements would not [1].
 
 The proposed change is to introduce a new flow control exception
 ``SkipStatement``, and skip the execution of the ``with``


More information about the Python-checkins mailing list