在 python 中,我有一个简短的评论 - 使用
#
语法 - 我想添加到一个语句中。成为文档字符串还不够重要;这只是一个小小的提醒。 Should I indent the second line of the comment to show that it is a continuation?
这是一个比较琐碎的问题,但我想确保我的代码符合标准的代码风格。但是,我无法通过谷歌搜索找到与此相关的任何内容。
这里有一个不缩进的例子:
# 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.
这里有一个缩进一个空格的例子:
# 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.
最后,这是一个缩进制表符的例子:
# 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.
哪种风格合适?有官方消息说吗?您或您认识的其他人更喜欢使用什么?