[Python-ideas] with-statement syntactic quirk

Eli Bendersky eliben at gmail.com
Wed Oct 31 13:33:04 CET 2012


On Wed, Oct 31, 2012 at 5:17 AM, Devin Jeanpierre <jeanpierreda at gmail.com>wrote:

> 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.
>

At the expense of making the tokenizer context dependent?

Eli
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20121031/a0cd2b0a/attachment.html>


More information about the Python-ideas mailing list