[Python-ideas] with-statement syntactic quirk
Raymond Hettinger
raymond.hettinger at gmail.com
Thu Nov 1 02:47:20 CET 2012
On Oct 31, 2012, at 3:38 AM, Barry Warsaw <barry at python.org> wrote:
> IWBNI you could write it like this:
>
> with (open('/etc/passwd') as p1,
> open('/etc/passwd') as p2):
> pass
>
> This seems analogous to using parens to wrap long if-statements, but maybe
> there's some subtle corner of the grammar that makes this problematic (like
> 'with' treating the whole thing as a single context manager).
>
> Of course, you can wrap with backslashes, but ick!
I would rather live a bashslash than have yet another change to the grammar
or have context-manager semantics added to tuples.
ISTM that this isn't a problem worth solving.
Raymond
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20121031/6382b55c/attachment.html>
More information about the Python-ideas
mailing list