Code style query: multiple assignments in if/elif tree

Ben Finney ben+python at benfinney.id.au
Mon Mar 31 18:57:31 EDT 2014


Chris Angelico <rosuav at gmail.com> writes:

> How do you go about doing multi-line comments? I know I've seen other
> code using triple-quoted strings for long comments before.

Just use a sequence of one-line comments::

    # Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut a
    # sapien tempor, suscipit orci sed, elementum nisl. Suspendisse at
    # lacus ut diam dignissim lobortis ac vitae augue.
    #
    # Phasellus bibendum neque a justo vulputate, quis accumsan quam
    # egestas. Etiam aliquet blandit ante sit amet cursus.

A decent code editor (e.g. Emacs, Vim) will allow manipulation of
a sequence of one-line comments in Python's comment style, and allow
treating it as a paragraphs for purposes such as re-wrapping the lines.

I agree with others that triple-quoted strings are best reserved for
string literals (including docstrings), not comments.

-- 
 \         “Alternative explanations are always welcome in science, if |
  `\   they are better and explain more. Alternative explanations that |
_o__) explain nothing are not welcome.” —Victor J. Stenger, 2001-11-05 |
Ben Finney




More information about the Python-list mailing list