Sometimes I need to temporarily comment out block headings for testing purpose, e.g.:
i = 2
s = { 'a', 'b', 'c' }
#while i > 0:
s.pop()
i -= 1
print(s)
but, since indentation is part of python’s syntax, if I run the code above I got:
s.pop()
^
IndentationError: unexpected indent
I know that dedenting the code inside the commented while would make it work, but I’d like to preserve a visual structure of my code instead of dedenting and indenting it each time.
Are there any trick to accomplish this?
What about
if True:as the alternate? Then just exchange the ‘#’ between thewhileandifto get your desired effect.