[Python-ideas] Making colons optional?

Steven D'Aprano steve at pearwood.info
Thu Feb 5 12:05:50 CET 2009


I forgot one other comment...

Riobard Zhan wrote:

> - I noticed a strong tendency to forget colons by new users of Python in 
> a second-year computer science undergraduate course. The students seemed 
> not getting used to colons even near the end of the course.

While I would not support the removal of colons, I would support a 
better error message when one is missing.

 >>> for x in 1,2,3
   File "<stdin>", line 1
     for x in 1,2,3
                  ^
SyntaxError: invalid syntax


Perhaps this should say why the syntax is missing?

SyntaxError: linebreak in statement or missing colon




-- 
Steven



More information about the Python-ideas mailing list