From: Mathias Panzenböck <grosser.meister.mo...@gmx.net>
Date: Thu, 01 Nov 2012 03:46:36 +0100
Local: Wed, Oct 31 2012 10:46 pm
Subject: Re: [Python-ideas] with-statement syntactic quirk
On 10/31/2012 10:03 PM, Arnaud Delobelle wrote:
> On 31 October 2012 10:38, Barry Warsaw <ba...@python.org> wrote:
Because that's not confusing. Why not write:
>> 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
>> with (open('/etc/passwd') as p1,
>> This seems analogous to using parens to wrap long if-statements, but maybe
>> Of course, you can wrap with backslashes, but ick!
> No need for backslashes, just put the brackets in the right place:
> with (
> ;)
with open('/etc/passwd'
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||