comments inside blocks

Peter Hansen peter at
Thu Jan 2 19:31:17 CET 2003

P_spam_ at wrote:
> Well it also folds if there is any amount of whitespace
> between the block and the comment. I.E.
> for i in range(10):
>      print i
> #comment nothing to do with for
> def fn():
>      print "fn"

Okay, good point.  Remember though, that this is also valid

for i in range(10):
    print i

# if we make it to the end, do this
    print 'loop completed normally!'

I'm afraid you probably can't get the behaviour you want without a lot
more logic than the program currently has.  It might be doable, but 
not easy...


More information about the Python-list mailing list