[Python-ideas] A real limitation of contextlib.nested()

Mathias Panzenböck grosser.meister.morti at gmx.net
Sun Mar 15 13:21:02 CET 2009


Oh, your right!

+1 for adding the new syntax.

Nick Coghlan wrote:
 > I missed the discussion about potentially adding syntactic support for
 > multiple context managers in the with statement, but figured I should
 > mention a real limitation of contextlib.nested that *would* be fixed by
 > adding dedicated syntactic support.
 >
 > There's a genuine semantic difference between this:
 >
 >   with cmA():
 >       with cmB():
 >           # whatever
 >
 > and this:
 >
 >   with nested(cmA(), cmB()):
 >       # whatever
 > ...



More information about the Python-ideas mailing list