Indendentation of Python Multi-line Comment

75 views Asked by At

In python, I have a short comment - using the # syntax - that I want to add to a statement. It isn't important enough to be a docstring; it's just a little reminder.
The comment takes up two lines, which gives me a style decision:

Should I indent the second line of the comment to show that it is a continuation?

This is a relatively trivial issue, but I want to make sure my code is conformant to standard code styles. However, I could not find anything related to this by a google search.

Here's an example of not indenting:

# Idea 1 is a really good idea,
# uhoh I ran out of space so
# I'm using multiple lines.
# Idea 2 is also a really good
# idea, and I also ran out of
# space for this one.

Here's an example of indenting one space:

# Idea 1 is a really good idea,
#  uhoh I ran out of space so
#  I'm using multiple lines.
# Idea 2 is also a really good
#  idea, and I also ran out of
#  space for this one.

And finally, here's an example of indenting a tab:

# Idea 1 is a really good idea,
#     uhoh I ran out of space so
#     I'm using multiple lines.
# Idea 2 is also a really good
#     idea, and I also ran out of
#     space for this one.

Which one is the right style? Is there an official source that says? What do you or others you know prefer to use?

0

There are 0 answers