[Tutor] multiline comment in Python

Alan Gauld alan.gauld at blueyonder.co.uk
Fri Sep 5 00:09:25 EDT 2003


> hello all, I am wondering if there is anything other than triple
quotes
> for multiline commenting blocks of code.

triple quotes aren't really comments, although they kind of act like
that.

But if you use IDLE or Pythonwin or Emacs you can select a block
and comment it out (and later uncomment it if need be) using editor
commands.

And using vi(or vim or elvis) its nearly as easy.
[using :m,ns/^/#/  and :m,ns/^#//  in vim you can use the visual
block mode to select the comment region. I suppose you could even map
it to a key if you wanted]

In other words you can type the comment text in and then
retrospectively turn it into a comment...

HTH,

Alan G.




More information about the Tutor mailing list