From: Georg Brandl Date: Sun, 15 Mar 2009 21:44:43 +0000 (+0000) Subject: #5491: clarify nested() semantics. X-Git-Tag: v2.7a1~1857 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5a95b21fee671bde9ab843a6a503cce5dafeb002;p=python #5491: clarify nested() semantics. --- diff --git a/Doc/library/contextlib.rst b/Doc/library/contextlib.rst index 8c10c95494..935afeeba9 100644 --- a/Doc/library/contextlib.rst +++ b/Doc/library/contextlib.rst @@ -63,14 +63,15 @@ Functions provided: from contextlib import nested - with nested(A, B, C) as (X, Y, Z): + with nested(A(), B(), C()) as (X, Y, Z): do_something() is equivalent to this:: - with A as X: - with B as Y: - with C as Z: + m1, m2, m3 = A(), B(), C() + with m1 as X: + with m2 as Y: + with m3 as Z: do_something() Note that if the :meth:`__exit__` method of one of the nested context managers