[Python-checkins] r70390 - python/trunk/Doc/library/contextlib.rst
georg.brandl
python-checkins at python.org
Sun Mar 15 22:44:43 CET 2009
Author: georg.brandl
Date: Sun Mar 15 22:44:43 2009
New Revision: 70390
Log:
#5491: clarify nested() semantics.
Modified:
python/trunk/Doc/library/contextlib.rst
Modified: python/trunk/Doc/library/contextlib.rst
==============================================================================
--- python/trunk/Doc/library/contextlib.rst (original)
+++ python/trunk/Doc/library/contextlib.rst Sun Mar 15 22:44:43 2009
@@ -63,14 +63,15 @@
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
More information about the Python-checkins
mailing list