Python is readable

Kiuhnm kiuhnm03.4t.yahoo.it
Fri Mar 16 13:36:25 CET 2012


On 3/16/2012 0:52, Steven D'Aprano 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.

IMHO, Python misuses colons.
No grammarian would ever write
   "If you can: take the bus."
Natural languages are irregular while Python strives to be as regular as 
possible.
BTW, I prefer
     The matrix
        [....]
     can be ..... and it gives
        [....]
     which .....
to
     The matrix:
        [....]
     can be ..... and it gives:
        [....]
     which ....
Colons should introduce more specific information, not all the 
information. For instance, "I like many things in life: <list>" is way 
better than "I like: <list>".
As you can see, I'm not an English native speaker, but I think I know a 
few things about punctuation. We second language learners remember all 
the wrong things :(

Kiuhnm



More information about the Python-list mailing list