[Python-ideas] with-statement syntactic quirk

Devin Jeanpierre jeanpierreda at gmail.com
Wed Oct 31 13:17:10 CET 2012


On Wed, Oct 31, 2012 at 6:38 AM, Barry Warsaw <barry at python.org> wrote:
> 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).

This seemed kind of icky when I read it, and I think Nick Coghlan
stated the reason best.

Is there a reason the tokenizer can't ignore newlines and
indentation/deindentation between with/etc. and the trailing colon?
This would solve the problem in general, without ambiguous syntax.

-- Devin



More information about the Python-ideas mailing list