[Python-ideas] with statement: multiple context manager

Mathias Panzenböck grosser.meister.morti at gmx.net
Sun Mar 1 15:30:38 CET 2009


Why not use this?

from contextlib import nested
with nested(lock, open(infile), open(outfile, 'w')) as (_, fin, fout):
    fout.write(fin.read())


Ok, the _ is ugly, but is it ugly enough so we need this extension to the with 
statement?

	-panzi



More information about the Python-ideas mailing list