Colons, indentation and reformatting.

Leif K-Brooks eurleif at ecritters.biz
Tue Jan 9 04:29:55 EST 2007


Paddy wrote:
> 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 it reindent this code?

if foo:
print "Foo!"
if bar:
print "Bar!"

Like this?

if foo:
     print "Foo!"
if bar:
     print "Bar!"

Or like this?

if foo:
     print "Foo!"
     if bar:
         print "Bar!"



More information about the Python-list mailing list