Skip to content

Commit b7706b5

Browse files
committed
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 ........
1 parent 5250401 commit b7706b5

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

Lib/contextlib.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,19 +87,17 @@ def helper(*args, **kwds):
8787

8888
@contextmanager
8989
def nested(*managers):
90-
"""Support multiple context managers in a single with-statement.
90+
"""Combine multiple context managers into a single nested context manager.
9191
92-
Code like this:
93-
94-
with nested(A, B, C) as (X, Y, Z):
95-
<body>
92+
This function has been deprecated in favour of the multiple manager form
93+
of the with statement.
9694
97-
is equivalent to this:
95+
The one advantage of this function over the multiple manager form of the
96+
with statement is that argument unpacking allows it to be
97+
used with a variable number of context managers as follows:
9898
99-
with A as X:
100-
with B as Y:
101-
with C as Z:
102-
<body>
99+
with nested(*managers):
100+
do_something()
103101
104102
"""
105103
warn("With-statements now directly support multiple context managers",

0 commit comments

Comments
 (0)