[issue1435] Support for multiple handlers for the "with" statement

Stavros Korokithakis report at bugs.python.org
Tue Nov 13 13:18:00 CET 2007


New submission from Stavros Korokithakis:

Currently, the new "with" statement does not support multiple handlers. 
For example, to open two files for input/output you would have to do:

with open("filein") as input:
    with open("fileout") as output:
        #Do stuff
        pass

This adds unnecessary complexity, and would be unwieldy with multiple 
code blocks. Would something like the following be feasible?

with open("filein") as input, open("fileout") as output:
    # Do stuff
    pass

This syntax is fully backwards-compatible, so there shouldn't be any 
problem there.

----------
components: None
messages: 57446
nosy: Stavros
severity: minor
status: open
title: Support for multiple handlers for the "with" statement
type: behavior
versions: Python 2.5

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1435>
__________________________________


More information about the Python-bugs-list mailing list