[Python-ideas] with-statement syntactic quirk

Mathias Panzenböck grosser.meister.morti at gmx.net
Thu Nov 1 03:43:35 CET 2012


On 10/31/2012 05:37 PM, Joachim König wrote:
> On 31/10/2012 16:42, Guido van Rossum wrote:
>> Yeah, the problem is that when you see a '(' immediately after 'with',
>> you don't know whether that's just the start of a parenthesized
>> expression or the start of a (foo as bar, blah as blabla) syntactic
>> construct.
>
> but couldn't "with" be interpreted as an additional kind of opening parantheses (and "if", "for",
> "while",
> "elif", "else" too) and the ":" as the closing one?
>

What about "def", "class", "lambda" and "except"?

> I'm sure this has been asked a number of times but I couldn't find an answer.
>
> Joachim




More information about the Python-ideas mailing list