shoenig/UTCS-Webturnin-Utilz — Issue #4: Reduce excessive with nests with multi-context with statements
Author: shoenig
Created: 2012-03-06 18:29:08+00:00
State: open

To directly quote Pydoc:

The with statement can now use multiple context managers in one statement. Context managers are processed from left to right and each one is treated as beginning a new with statement. This means that:

with A() as a, B() as b:
... suite of statements ...

is equivalent to:

with A() as a:
with B() as b:
... suite of statements ...