Python is readable

Steven D'Aprano steve+comp.lang.python at pearwood.info
Fri Mar 16 14:03:22 CET 2012


On Fri, 16 Mar 2012 13:36:25 +0100, Kiuhnm wrote:

> On 3/16/2012 0:52, Steven D'Aprano wrote:

>> 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.

According to the rules of which language?

Latin? Cantonese? Russian? Or perhaps Perl? Javascript? Forth?


> No grammarian would ever write
>    "If you can: take the bus."

A grammarian might very well write:

Your assignment, if you choose to accept it, is to:

1. Take the bus to Swansea.
2. Go across the road to the little shop on the corner.
3. Ask for Dave.
4. Tell him George sent you.
5. He will give you a package. Take it to the park down the street.
6. You will see a man making balloon animals. Give him the package.
7. He will give you a balloon giraffe. Take it to the pub.
8. Put the giraffe on the piano in the public bar, and leave.


In English, one typical use for colons is to introduce a list or sequence 
of items, including instructions. A sequence of instructions is an 
algorithm, program or routine. You may have heard of them :)

A one line routine is still a routine. There is nothing ungrammatical 
about "If you can: take the bus.", although it is non-idiomatic English.


> Natural languages are irregular while Python strives to be as regular as
> possible.

So what?



-- 
Steven



More information about the Python-list mailing list