comments inside blocks

P at draigBrady.com P at draigBrady.com
Fri Jan 3 05:34:19 EST 2003


Peter Hansen wrote:
> P_spam_ at draigBrady.com 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
> Python:
> 
> for i in range(10):
>     print i
> 
> # if we make it to the end, do this
> else:
>     print 'loop completed normally!'

well the else (same level) is never folded along with the for

> 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...

I think it would be easy to say once anything appears at
the same level then stop folding? (except when brackets are involved..
hmm this seems broken also (I'll expand below)).

Pádraig.





More information about the Python-list mailing list