This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Unsupported provider

classification
Title: Clarify contextlib.nested semantics
Type: Stage:
Components: Documentation Versions:
process
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 2022-04-11 14:56 by admin. 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):
    do_something()

with A as X:
    with B as Y:
        with C as Z:
            do_something()

Recommended docs change:

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

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

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.
History
Date User Action Args
2022-04-11 14:56:46adminsetgithub: 49741
2009-03-15 21:44:52georg.brandlsetstatus: open -> closed

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