[Tutor] Comment

Cameron Simpson cs at cskk.id.au
Fri Aug 23 19:13:45 EDT 2019


On 23Aug2019 22:36, 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.

I sometimes put the code in an "if False:" statement.

There isn't a multiline comment syntax, so you need to either comment 
out individual lines or use a multiple contruct (eg the "if" statement) 
or your suggestion of the triple quoted string (though that breaks as 
soon as the enclosed code itself has such a string).

Cheers,
Cameron Simpson <cs at cskk.id.au>


More information about the Tutor mailing list