On 2020-01-16 21:08, Rob Cliffe via Python-ideas wrote:
On 16/01/2020 18:14:18, Random832 wrote:
On Tue, Jan 14, 2020, at 18:15, David Mertz wrote:
For what it's worth, after 20+ years of using Python, forgetting the colon for blocks remains the most common error I make by a fairly wide margin. Of course, once I see the error message—even being not all that descriptive of the real issue—I immediately know what to fix too. I don't know about "most common" but I do it fairly frequently. What if the colon were made optional, with an eye to perhaps eventually no longer using it as the preferred style for new code?
We had a post a while ago about the possibility of using the lack of a colon as an implicit line continuation (like with parentheses, e.g. "if a\nand b:", and this was (reasonably) rejected. But if a line beginning as a compound statement and ending without a colon is *never* going to have a valid meaning as something else... what's the point of the colon, otherwise? Seems like just grit on the screen. +1
FWIW, I've hardly ever forgotten the colon, even when Python was new to me.