Oct. 31, 2012
7:29 p.m.
On Wed, 31 Oct 2012 11:38:53 +0100 Barry Warsaw <barry@python.org> wrote:
with-statements have a syntactic quirk, which I think would be useful to fix. This is true in Python 2.7 through 3.3, but it's likely not fixable until 3.4, unless of course it's a bug <wink>.
Legal:
with open('/etc/passwd') as p1, open('/etc/passwd') as p2: pass
Not legal:
with (open('/etc/passwd') as p1, open('/etc/passwd') as p2): pass
Why is this useful? If you need to wrap this onto multiple lines, say to fit it within line length limits. IWBNI you could write it like this:
with (open('/etc/passwd') as p1, open('/etc/passwd') as p2): pass
This bit me a couple of days ago. +1 for supporting it. Regards Antoine.