diff options
author | Nick Coghlan <ncoghlan@gmail.com> | 2009-06-23 10:19:30 +0000 |
---|---|---|
committer | Nick Coghlan <ncoghlan@gmail.com> | 2009-06-23 10:19:30 +0000 |
commit | 0d8b4e33e759b34dabb2cfc51087c99077912d7a (patch) | |
tree | af813f2dc3e7b03802fbda57a92bcd64bc985085 /Lib/contextlib.py | |
parent | 94819cf47ce2c626cd32bda2a292ec6e50a1cd07 (diff) | |
download | cpython-git-0d8b4e33e759b34dabb2cfc51087c99077912d7a.tar.gz |
Issue 6288: Update contextlib.nested() docstring to reflect new documentation
Diffstat (limited to 'Lib/contextlib.py')
-rw-r--r-- | Lib/contextlib.py | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/Lib/contextlib.py b/Lib/contextlib.py index 6fcb5360eb..a27c869250 100644 --- a/Lib/contextlib.py +++ b/Lib/contextlib.py @@ -87,19 +87,17 @@ def contextmanager(func): @contextmanager def nested(*managers): - """Support multiple context managers in a single with-statement. + """Combine multiple context managers into a single nested context manager. - Code like this: - - with nested(A, B, C) as (X, Y, Z): - <body> + This function has been deprecated in favour of the multiple manager form + of the :keyword:`with` statement. - is equivalent to this: + The one advantage of this function over the multiple manager form of the + :keyword:`with` statement is that argument unpacking allows it to be + used with a variable number of context managers as follows: - with A as X: - with B as Y: - with C as Z: - <body> + with nested(*managers): + do_something() """ warn("With-statements now directly support multiple context managers", |