An interesting beginner question: why we need colon at all in the python language?

Grant Edwards invalid at invalid.invalid
Wed Jul 13 15:18:30 CEST 2011

On 2011-07-13, Steven D'Aprano <steve+comp.lang.python at> wrote:
> Thorsten Kampe wrote:
>> * Thomas Jollans (Mon, 11 Jul 2011 16:16:17 +0200)
>>> Basically, it looks better, and is more readable.
>> People tend to overlook the colon for the same reason they tend to
>> forget to set the colon in the first place:
>> a) it's a very weak marker in comparison to indentation and
>> b) it looks like doubling the markup to them (colon plus indentation)
> I can't speak for others, but speaking for myself, I wonder whether this is
> a difference between English speakers and non-English speakers? To me, as a
> native English speaker, leaving the colon out of a header line, as follows
> below, just looks wrong.
>     Nobody expects the Spanish Inquisition! <OMINOUS MUSIC>
>     Our three weapons are
>         * fear
>         * surprise
>         * and ruthless efficiency
>         * and an almost fanatical devotion to the Pope!

Except that's wrong English[1]. At least that's not correct usage
according to what I learned in school.  A colon follows an independent
clause: something that could in essence be a complete sentence and
expresses a complete thought.  The colon separates that independent
clause from examples or an explanation or clarification of that
independent clause.  The phrase "Our three weapons are" isn't an
independent clause. It has the transitive verb "are" but no predicate
nominative.  You've placed the colon in the middle of an independent
clause between the verb "are" and the predicate nominative phrase
"fear, surprise, and ruthless efficiency, and an almost fanatical
devotion to the Pope".

Your example should be something like this [accurace of the quotation

     The Spanish Inquisition has three main weapons: fear, surprise,
     ruthless efficiency, and an almost fanatical devotion to the
> Although the bullet list is indented, the header line "Our three weapons
> are" looks like something is missing,

Something is missing.  It's not a complete independent clause.

> as if I had started to write something and forgotten to finish.

Except a colon doesn't "complete" an independent clause that's
otherwise incomplete.

> It needs a colon to be complete:
>     Nobody expects the Spanish Inquisition! <JARRING CHORDS>

Now, that usage is correct.

> The colon indicates that the sentence has more to follow: I think of
> it as a pointer.

That is correct also.

> On the other hand, a colon gives the reader that connection:
>     It gives the reader a clue to expect additional information, 
>     that the indented block that follows is not an independent 
>     block, floating in space for its own reasons, but is intimately 
>     linked to the previous line.


[1] Since all posts criticising grammar or spelling will have an above
    average number of grammar and spelling errors, I thought I'd get
    a head start on it.

Grant Edwards               grant.b.edwards        Yow! I'm ZIPPY the PINHEAD
                                  at               and I'm totally committed
                                to the festive mode.

More information about the Python-list mailing list