Nick Coghlan committed 45506be

Merged revisions 73518-73519 via svnmerge from

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

Comments (0)

Files changed (1)


 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:
+   This function has been deprecated in favour of the multiple manager form
+   of the with statement.
-        with nested(A, B, C) as (X, Y, Z):
-            <body>
+   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:
-    is equivalent to this:
-        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",
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.