diff options
author | Nick Coghlan <ncoghlan@gmail.com> | 2009-06-23 10:55:52 (GMT) |
---|---|---|
committer | Nick Coghlan <ncoghlan@gmail.com> | 2009-06-23 10:55:52 (GMT) |
commit | b7706b58fae704458b090e3c5ce4eb7bd73091e3 (patch) | |
tree | 74d8b0766c51670288a810d3f8ca7cf234f0d1fd /Lib/contextlib.py | |
parent | 5250401bd0223ce03f9e5ea36edd13798ba77187 (diff) | |
download | cpython-b7706b58fae704458b090e3c5ce4eb7bd73091e3.zip cpython-b7706b58fae704458b090e3c5ce4eb7bd73091e3.tar.gz cpython-b7706b58fae704458b090e3c5ce4eb7bd73091e3.tar.bz2 |
Merged revisions 73518-73519 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r73518 | nick.coghlan | 2009-06-23 20:19:30 +1000 (Tue, 23 Jun 2009) | 1 line
Issue 6288: Update contextlib.nested() docstring to reflect new documentation
........
r73519 | nick.coghlan | 2009-06-23 20:51:02 +1000 (Tue, 23 Jun 2009) | 1 line
Remove markup from docstring
........
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 82adcd3..bffa0c4 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 with statement. - is equivalent to this: + The one advantage of this function over the multiple manager form of the + 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", |