python newbie: some surprises

Yves Dorfsman yves at zioup.com
Fri May 9 11:08:51 EDT 2008


Gabriel Genellina wrote:

>> I see the point of the OP. Couldn't the new-line be used as an 
>> equivalent of   ':', for example, do you find this difficult to read:
>>
>> if a == 3
>>    do_something()
>>
>>
>> if a == 3: do_something()
> 
> Yes, it could be done, there are no technical reasons to always force to 
> use ":". But AFAIK the main reasons to keep ":" are internal consistency 
> (an inner block always starts with ":"; incidentally, that's easier to 
> handle for editors) and legibility (the ":" stands for itself and has a 
> meaning)

Legibility ?
But one could make the same argument for curly brackets, and we seem to be 
doing fine without them !

I have become so used to the power of indenting in python that I keep 
forgetting the colon, and this is getting worse as I do more python, not 
better. Maybe I'll write myself a "pre-compiler" that add the colons where 
the compiler needs them :-)


Yves.
http://www.SollerS.ca




More information about the Python-list mailing list