Index: Doc/whatsnew/2.7.rst =================================================================== --- Doc/whatsnew/2.7.rst (revision 73405) +++ Doc/whatsnew/2.7.rst (working copy) @@ -150,6 +150,21 @@ now accept ``None`` as its first argument. (Fixed by Georg Brandl; :issue:`4759`.) +* The syntax of the :keyword:`with` statement now allows multiple context + managers in a single statement:: + + >>> with open('mylog.txt') as infile, open('a.out', 'w') as outfile: + ... for line in infile: + ... if '' in line: + ... outfile.write(line) + + With the new syntax, the :func:`contextlib.nested` function is no longer + needed and is now deprecated. + + (Contributed by Georg Brandl and Mattias Brändström; + `appspot issue 53094 `_. Back-ported + to 2.7 by Georg Brandl.) + .. ======================================================================