Python is readable

Steven D'Aprano steve+comp.lang.python at pearwood.info
Thu Mar 15 19:52:01 EDT 2012


On Fri, 16 Mar 2012 01:48:09 +1100, Chris Angelico wrote:

> On Fri, Mar 16, 2012 at 1:30 AM, Kiuhnm
> <kiuhnm03.4t.yahoo.it at mail.python.org> wrote:
>> Sorry, but I can't see how it would make it harder for humans to
>> understand. Are there particular situations you're referring to?
> 
> In a trivial example, it's mostly just noise:
> 
> if a == b    # who needs the colon?
>     print(c)

The reader, for the same reason that above you wrote:

"In a trivial example, it's mostly just noise COLON"

and indeed I too used a colon for the same reason. It ties the lead 
sentence to the following block without ending the sentence, but still 
introducing a new grouping or clause.

It is *remarkable* how people take the colon for granted. It is so simple 
and so obvious that they use it in their own writing often without 
thinking about it, but because it is not strictly necessary to avoid 
ambiguity in the grammar, they fool themselves into thinking that it is 
"just noise" or "pointless". It is not noise, it is a hint to the reader.

Again, applying to both computer languages and natural languages, leaving 
out punctuation (either in the grammar, or just out of laziness) is doing 
a great disservice to the reader. The time the writer saves by not 
inserting punctuation is lost a million times for the reader (we read 
text and code thousands of times more than we write it, and there are 
thousands more readers than writers). Leaving out punctuation is a real 
pessimation: an example of being "penny wise and pound foolish".



-- 
Steven



More information about the Python-list mailing list