how to comment out a block of code

Duncan Booth duncan.booth at invalid.invalid
Thu Jan 27 06:57:18 EST 2005

Xah Lee wrote:

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

More information about the Python-list mailing list