[Tutor] Comment
eryk sun
eryksun at gmail.com
Fri Aug 23 19:23:06 EDT 2019
On 8/23/19, Olsen, Avalow Y <Yuanyuan.A.Olsen at healthpartners.com> wrote:
>
> 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.
Note that if a string literal is the first statement of a code block,
not counting comments, the compiler will store it as the doc string.
It's not an issue if the code block already has a doc string.
>>> class A:
... # watch out
... '''
... def spam(self): pass
... '''
...
>>> A.__doc__
'\n def spam(self): pass\n '
More information about the Tutor
mailing list