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

Jeremy Bowers jerf at jerf.org
Sat Mar 26 00:50:39 EST 2005


On Fri, 25 Mar 2005 11:31:33 -0800, James Stroud wrote:
> 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.

It depends. Are you looking to eliminate punctuation entirely, or strike a
proper balance?

Yes, it's a loaded question, but yes, it reflects reality. 

Go look at a few hundred lines of Python code. Strip the colons off of the
end. Barring the

if bleh: something()

one-liners*, it starts to look like a giant run on sentence to me.

That's the native English speaker in me, but still, the historic trend was
to add some punctuation as soon as technology made it non-burdensome. You
don't *need* vowels in written text, either, but I see you and your
language using them.

Readability counts.
... practicality beats purity.

Dropping the colon would just be getting silly.

*: Where the colon *is* necessary; you need *something* to
delimit the condition from the action, we've discussed this in the past
but here's an example:

if (a)(b)(c) 

can be

if (a):(b)(c)
if (a)(b):(c)
)



More information about the Python-list mailing list