Multi-Line Comment

Tim Peters tim.one at comcast.net
Mon Aug 11 16:24:23 EDT 2003


[Skip Montanaro]
> Nope, no multi-line comment.  The python-mode package which is
> available for Emacs and XEmacs supports commenting a block of text.
> You can also use triple-quoted strings:
>
>     """
>     This is a multi-
>     line
>     comment
>     (sort of)
>     """
>
> It gets evaluated but immediately popped from the execution stack.

One of the previous times this came up, Guido suggested that the compiler
could be changed to optimize away string expressions that aren't docstrings.
It was then my task to fire up the time machine so that I could report that
the compiler already did.  It still does <wink>.  That is, it doesn't get
evaluated or popped -- it's not in the compiled code at all, so is exactly
like a comment in that respect.






More information about the Python-list mailing list