[Tutor] Comments

Kevin Altis altis@semi-retired.com
Fri Jan 3 15:13:41 2003


There are a few ways. You could comment out every line

#    code
#    ...
#    won't run

comment out the block with triple quotes
    """
    code
    ...
    won't run
    """

or you could just indent the whole block and stick a test in front so it
won't be executed
    if 0:
        code
        ...
        won't run

The last one is probably best if what you really want is something like

    if DEBUG:
        print ...

where you define DEBUG as 1 or 0 at the top of the module.

ka

> -----Original Message-----
> From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of
> Adam Vardy
> Sent: Friday, January 03, 2003 11:49 AM
> To: tutor@python.org
> Subject: [Tutor] Comments
>
>
>
> How is it you phrase comments?  When I'd like to take out a block and
> experiment with the rest, what's the method?
>
>  {
>
>  code
>  ...
>
>  won't run
>
>  }
>
>  print "will run"
>
> --
> Adam Vardy
>
>
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>