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

Grant Edwards invalid at invalid.invalid
Mon Jul 11 10:43:53 EDT 2011

On 2011-07-11, Thomas Jollans <t at> wrote:
> On 07/11/2011 03:51 PM, Anthony Kong wrote:
>> Hi, all,
>> Lately I am giving some presentations to my colleagues about the python
>> language. A new internal project is coming up which will require the use
>> of python.
>> One of my colleague asked an interesting:
>> /If Python use indentation to denote scope, why it still needs
>> semi-colon at the end of function declaration and for/while/if loop?/
>> My immediate response is: it allows us to fit statements into one line.
>> e.g. if a == 1: print a
>> However I do not find it to be a particularly strong argument. I think
>> PEP8 does not recommend this kind of coding style anyway, so one-liner
>> should not be used in the first place!
> Basically, it looks better, and is more readable.

And it makes adding a "python mode" to a programming editor almost

Grant Edwards               grant.b.edwards        Yow! I am a jelly donut.
                                  at               I am a jelly donut.

More information about the Python-list mailing list