[Tutor] Comment
David Lowry-Duda
david at lowryduda.com
Sat Aug 24 09:04:22 EDT 2019
> Is there a mechanism to comment out large blocks of Python code? So
> far, the only ways I can see of commenting out code are to either
> start every line with a #, or to enclose the code in triple quotes.
The two methods you describe (# and """<stuff>""") are the two
mechanical ways of commenting out large blocks of code in python. In
practice, this is a bit separate from how one should approach it within
one's editor. Each sufficiently advanced editor should have a mechanism
to comment/uncomment many lines for you.
For instance, in pycharm one can use CTRL+SHIFT+/ to comment out a block
of code (or navigate to some menu). In vim, one can use vim-commentary
or enter block mode with CTRL-v, highlight the lines you want to be
commented, and then I# to comment them. (I'm sure other nice editors out
there have this functionality too, but I only use these).
> Thank you in advance!
Good luck!
DLD
More information about the Tutor
mailing list