Colon and underscores

Andrei Kulakov sill at optonline.net
Sun Jul 29 15:14:36 CEST 2001


On Sat, 28 Jul 2001 22:35:23 GMT, Neil Hodgson <nhodgson at bigpond.net.au> wrote:
> Andrei Kulakov:
> 
>> Besides, editors detect that : and autoindent for you. Imagine for
> instance
>> that you are 5 levels of indentation to the right, if there were no colons
>> you'd have to hit enter and then <tab> 5 times! No thanks :P
> 
>    Editors can also detect that you started the line with a structuring
> keyword (if, def, ...) and indent. The colon is really only needed when you
> want to place the body on the same line:

Well, it's easier for an editor to check if the line ends in ':' than check
for several keywords and check if they're in a string or not.. If we had
one editor everybody used, it wouldn't be a big deal, but with hundreds of
editors out there, this is a consideration.. But I agree, readability is
more important here. I didn't mention it because to the original inquirer,
it doesn't seem more readable.. so I gave him a firm, objective reason instead
:-).

> 
>     if a: b = 1
> 
>    I'd be happy to see Python without the colons at the end of lines but its
> no big deal.
> 
>    Neil

def isn't absolutely required, either.. parser could detect difference
between

do_stuff()
[...]

and

do_stuff()
    [...]    

But def is a good visual cue.. for me, at least.
> 
> 
> 


-- 
Cymbaline: intelligent learning mp3 player - python, linux, console.
get it at: http://silmarill.org/cymbaline



More information about the Python-list mailing list