An interesting beginner question: why we need colon at all in the python language?

Terry Reedy tjreedy at udel.edu
Wed Jul 13 18:18:18 CEST 2011


On 7/13/2011 2:26 AM, alex23 wrote:
> Thomas Jollans<t... at jollybox.de>  wrote:
>> Coincidentally, Guido wrote this blog post just last week, without which
>> I'd be just as much at a loss as you:
>>
>> http://python-history.blogspot.com/2011/07/karin-dewar-indentation-an...
>
> It's also part of the Python FAQ:
>
> http://docs.python.org/faq/design.html#why-are-colons-required-for-the-if-while-def-class-statements

An added note: the header lines of compound statements do not 
necessarily occupy just one physical line. The : signals the end of the 
logical line. Editors can use to to indent intelligently. Consider

def myfunc(a,
            b,
            c):
     return a+b+c

All indentation was done automatically by IDLE's editor.

-- 
Terry Jan Reedy




More information about the Python-list mailing list