Colons, indentation and reformatting. (2)

mensanator at mensanator at
Tue Jan 9 07:42:04 CET 2007

Paddy wrote:
> I was just perusing a Wikipedia entry on the "off side rule" at
> .
> It says that the colon in Python is purely for readability, and cites
> our FAQ entry
>  .
> However, near the top of the Alternatives section, it states that for C
> type, curly braces using languages:
>   "An advantage of this is that program code can be automatically
> reformatted and neatly indented without fear of the block structure
> changing".
> Thinking about it a little, it seems that a colon followed by
> non-indented code that has just been pasted in could also be used by a
> Python-aware editor as a flag to re-indent the pasted code.

How would you re-indent this?

if x>0: print x

> Tell me it is not so, or I will be editing the Wikipedia page I think.
> - Paddy.

More information about the Python-list mailing list