how to comment out a block of code

C

Christian von Essen

A bit of a hack of course, but you can enclose the code that should be
commented out with ''' and ''' or """ and """ (not sure about the name of
this tripple-quoting)
OTOH, some (or even most if not all) Python editors support blockquoting
by pushing a button or using shortcuts. SPE and IDLE for example.
 
D

Duncan Booth

Xah said:
is there a syntax to comment out a block of code? i.e. like html's <!--
comment -->
or perhaps put a marker so that all lines from there on are ignored?
thanks.

The simplest way is to select the block of code in your editor and use the
'comment-region' command. If this doesn't work, upgrade your editor.

Most editors have a command to do this although obviously the name will
vary slightly: Idle calls it 'Comment Out Region', SciTe calls it 'Block
Comment', emacs calls it 'comment-region'.
 
J

Jeff Shannon

Xah said:
is there a syntax to comment out a block of code? i.e. like html's <!--
comment -->
or perhaps put a marker so that all lines from there on are ignored?
thanks.

Of course -- this feature is so important that all computer
manufacturers worldwide have made a special button on the computer
case just for this!

Normally it's a large round button, with perhaps a green backlight.
Press the button and hold it in for about 3 seconds, and the rest of
your code/writing will be ignored just as it should be.

Jeff Shannon
Technician/Programmer
Credit International
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top