Title: Clarify contextlib.nested semantics
Type: Stage:
Components: Documentation Versions:
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: georg.brandl Nosy List: georg.brandl, ncoghlan
Priority: normal Keywords:

Created on 2009-03-15 04:51 by ncoghlan, last changed 2009-03-15 21:44 by georg.brandl. This issue is now closed.

Messages (2)
msg83619 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2009-03-15 04:51
Current doc example:

with nested(A, B, C) as (X, Y, Z):

with A as X:
    with B as Y:
        with C as Z:

Recommended docs change:

with nested(A(), B(), C()) as (X, Y, Z):

m1, m2, m3 = A(), B(), C()
with m1 as X:
    with m2 as Y:
        with m3 as Z:

This makes it clearer that when using nested, the context managers are
all created outside the scope of the with statement.
msg83643 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2009-03-15 21:44
Thanks, committed in r70390.
Date User Action Args
2009-03-15 21:44:52georg.brandlsetstatus: open -> closed

messages: + msg83643
resolution: fixed
2009-03-15 04:51:08ncoghlancreate