multiline comments
Jorge Godoy
godoy at ieee.org
Wed Apr 19 16:09:51 EDT 2006
rx wrote:
> Still a little strange to newcomers that there are three ways to do the
> same and that you should be carefull to use the right '''/""" inside the
> comment else the comment will not work for some reason.
>
> #comment
>
> '''
> comment
> '''
>
> """
> comment
> """
Please, note that triple quotes are not for comments. They may be used like
that and they are used like that, but their primary intention is for
multiline strings (something like the here docs in Perl, for example).
Triple quotes can also be used like this:
usage = """
This program accepts the following options:
--help, -h Display this message
--verbose, -v Display more details
"""
This defines a multiline string. If you had to use only single quotes then
you'd have to insert "\n" for each newline.
--
Jorge Godoy <godoy at ieee.org>
"Quidquid latine dictum sit, altum sonatur."
- Qualquer coisa dita em latim soa profundo.
- Anything said in Latin sounds smart.
More information about the Python-list
mailing list