A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2014-August/135760.html below:

[Python-Dev] Multiline with statement line continuation

[Python-Dev] Multiline with statement line continuationGeorg Brandl g.brandl at gmx.net
Tue Aug 12 20:52:44 CEST 2014
On 08/12/2014 06:57 PM, Armin Rigo wrote:
> Hi,
> 
> On 12 August 2014 01:08, Allen Li <cyberdupo56 at gmail.com> wrote:
>>     with (open('foo') as foo,
>>           open('bar') as bar,
>>           open('baz') as baz,
>>           open('spam') as spam,
>>           open('eggs') as eggs):
>>         pass
> 
> +1.  It's exactly the same grammar extension as for "from import"
> statements, for the same reason.

Not the same: in import statements it unambiguously replaces a list
of (optionally as-renamed) identifiers.  Here, it would replace an
arbitrary expression, which I think would mean that we couldn't
differentiate between e.g.

   with (expr).meth():        # a line break in "expr"
                              # would make the parens useful

and

   with (expr1, expr2):

cheers,
Georg

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4