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

Chris Angelico rosuav at gmail.com
Wed Jul 13 07:58:19 EDT 2011


On Wed, Jul 13, 2011 at 9:07 PM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> The colon indicates that the sentence has more to follow: I think of it as a
> pointer. It doesn't finish the thought, like a full stop, nor is it a mere
> pause, like a comma or semi-colon.
>
>    An indented block on its own is surprising. It just hangs there,
>    with no connection to what was going on before. Why is it indented?
>    Is it connected to the previous sentence?

It's not necessarily surprising, depending on context; the brain
automatically assumes that the indented block was originally said by
someone else.

    The <blockquote> tag defines a long quotation.

    A browser inserts white space before and after a blockquote
    element. It also insert margins for the blockquote element.

http://www.w3schools.com/tags/tag_blockquote.asp

(I didn't need to quote that, I just wanted to go meta and block quote
something about blockquote.)

Having the colon makes it clear that the content is part of the same
general thought (paragraph or sentence).

Chris Angelico



More information about the Python-list mailing list