note that there is a FAQ about this:

https://docs.python.org/3/faq/design.html#why-are-colons-required-for-the-if-while-def-class-statements

And if you google hard enough (my 30 seconds wasn't enough), I'm pretty
sure you can find a description of actual usability tests (if informal)
mack in the day that indicated that the colon was helpful for readability,
if not for computer parsing.

-CHB


On Sun, Jan 19, 2020 at 7:49 AM Random832 <random...@fastmail.com> wrote:

> On Fri, Jan 17, 2020, at 21:32, Josh Rosenberg wrote:
> > The colon remains syntactically necessary in some cases, particularly
> > to disambiguate cases involving one-lining (no block involved). Stupid
> > example: If the colon is optional, what does:
>
> I was only proposing making it optional in the multi-line case.
>
> The following in the grammar:
>
> [anywhere it appears]: ... ':' suite
> suite: simple_stmt | NEWLINE INDENT stmt+ DEDENT
>
> would be replaced with
>
> [whatever]: ... compound_body
> compound_body: ':' simple_stmt | [':'] NEWLINE INDENT stmt+ DEDENT
>
> (I don't understand how TYPE_COMMENT interacts with NEWLINE/INDENT/DEDENT
> well enough to do the same for func_body_suite in terms of the actual
> grammar)
> _______________________________________________
> Python-ideas mailing list -- python-ideas@python.org
> To unsubscribe send an email to python-ideas-le...@python.org
> https://mail.python.org/mailman3/lists/python-ideas.python.org/
> Message archived at
> https://mail.python.org/archives/list/python-ideas@python.org/message/UGS2WPCEUWVOZFRZ6W2ZSDVN44OMSDG4/
> Code of Conduct: http://python.org/psf/codeofconduct/
>


-- 
Christopher Barker, PhD

Python Language Consulting
  - Teaching
  - Scientific Software Development
  - Desktop GUI and Web Development
  - wxPython, numpy, scipy, Cython
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/TZPIR2W7NE6ASVT5LFPMNZJ6K2N3J3SY/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to