Grouping code by indentation - feature or ******?

Larry Bates lbates at syscononline.com
Fri Mar 25 16:56:32 EST 2005


Can tell you that even when I was learning Python, I very
rarely forgot the colon (except when I've switched to
writing JavaScript or some other language that doesn't
use it and switch back to Python.  It seemed to make
sense.

As for the one-liner you mentioned, you may call it
cheating, but it is consistent with other languages
that allow single-line blocks this freedom and I don't
have a problem with "you can put one line after the colon
but not more than one" rule.

Larry Bates


James Stroud wrote:
> On Friday 25 March 2005 08:39 am, Ivan Van Laningham wrote:
> 
>>As far as grouping by indentation goes, it's why I fell in love with
>>Python in the first place.  Braces and so on are just extraneous cruft
>>as far as I'm concerned.  It's the difference between Vietnamese verbs
>>and Latin verbs;-)
> 
> 
> Say I buy into the indentation ideology. Python then has this inconsistency: :
> 
> Why do we need : at the end of our if and for loops? I spend approximately 6 
> minutes/100 lines of code going back and finding all of the times I missed :. 
> Is it for cheating?
> 
> if False: print ":"
> 
> Now, what happened to the whitespace idea here? This code seems very 
> unpythonic. I think : is great for slices and lamda where things go on one 
> line, but to require it to specify the start of a block of code seems a 
> little perlish.
> 



More information about the Python-list mailing list