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

This commit is contained in:
Nick Coghlan 2009-03-15 12:47:03 +00:00
parent cd484999f2
commit 0065f32940
1 changed files with 7 additions and 3 deletions

View File

@ -16,9 +16,13 @@ Abstract
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``