[Python-Dev] Multiline with statement line continuation

Devin Jeanpierre jeanpierreda at gmail.com
Wed Aug 13 02:41:32 CEST 2014

On Tue, Aug 12, 2014 at 8:12 AM, Guido van Rossum <guido at python.org> wrote:
> On Tue, Aug 12, 2014 at 3:43 AM, Devin Jeanpierre <jeanpierreda at gmail.com>
> wrote:
>> The parentheses seem unnecessary/redundant/weird. Why not allow
>> newlines in-between "with" and the terminating ":"?
>> with open('foo') as foo,
>>        open('bar') as bar,
>>        open('baz') as baz:
>>     pass
> That way lies Coffeescript. Too much guessing.

There's no syntactic ambiguity, so what guessing are you talking about?

What *really* requires guessing, is figuring out where in Python's
syntax parentheses are allowed vs not allowed ;). For example, "from
foo import (bar, baz)" is legal, but "import (bar, baz)" is not.
Sometimes it feels like Python is slowly and organically evolving into
a parenthesis-delimited language.

-- Devin

More information about the Python-Dev mailing list