Why aren't colons optional?

Grant Edwards grante at visi.com
Sun Jan 20 11:58:17 EST 2002


In article <3C4AAA46.BC5D570E at tds.net>, Edward K. Ream wrote:
>> Why are colons required after def, elif, else, except, finally, for, if,
>> try and while?  One would think the colon would be optional when the
>> colon is followed by a newline.
> 
> Thanks to all who replied.  To summarize the responses:  This is not a
> parser issue; apparently Guido believes colons increase readability.

IIRC, there were actual studies conducted with one of the
precursor languages (ABC?) which determined that the colon
increased readability -- at least for new programmers.

> Also, making trailing colons optional would impact many tools.
> 
> I am unconvinced, and I'm not going to press the issue.

Perhaps if you ask, somebody can provide a cite?

-- 
Grant Edwards                   grante             Yow!  Let's send the
                                  at               Russians defective
                               visi.com            lifestyle accessories!



More information about the Python-list mailing list