[Python-ideas] with-statement syntactic quirk

Cameron Simpson cs at zip.com.au
Thu Nov 1 23:14:31 CET 2012


On 31Oct2012 08:17, Devin Jeanpierre <jeanpierreda at gmail.com> wrote:
| 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.

To my mind one of the attractive features of the current syntax is that
forgetting the colon causes an immediate complaint. Once one allows an
arbitrary number of lines between (if,while,with) and the colon one is
into the same zone as several other languages, where a common mistake
can cause a syntax comoplain many lines beyond where the mistake was
made.

I understand the attractiveness here, but I think I would prefer staying
with the status quo (overt brackets or icky trailing sloshes) to extend
the lines in a condition over opening the syntax to complaints far beyond
the mistake.

Just 2c,
-- 
Cameron Simpson <cs at zip.com.au>

If you don't know what your program is supposed to do, you'd better not start
writing it. - Edsger W. Dijkstra



More information about the Python-ideas mailing list