From: Nick Coghlan Date: Tue, 23 Jun 2009 10:19:30 +0000 (+0000) Subject: Issue 6288: Update contextlib.nested() docstring to reflect new documentation X-Git-Tag: v2.7a1~915 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0d8b4e33e759b34dabb2cfc51087c99077912d7a;p=python Issue 6288: Update contextlib.nested() docstring to reflect new documentation --- 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): - + 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: - + with nested(*managers): + do_something() """ warn("With-statements now directly support multiple context managers",