Python 用“#”或“#:”评论
Python comment with "#" or "#:"
在Python中写评论时#
和#:
有什么区别?
'#'之后的所有内容都是注释,这只是品味问题。
小写、大写、驼峰写都可以,只要你看得懂你在评论什么。
如果你真的想评论你可以使用类似的东西:
#####################
###### TITLE ########
#####################
print 'hello world'
Flask 使用 Sphinx for documentation generation, and Sphinx uses #:
标记文档属性的注释:
For module data members and class attributes, documentation can either be put into a comment with special formatting (using a #:
to start the comment instead of just #
), or in a docstring after the definition.
此外,来自 Flask 的 style guide:
If a comment is used to document an attribute, put a colon after the opening pound sign (#
)
如果您没有使用像 Sphinx 这样理解 #:
的文档生成器,那么使用 #:
注释是没有意义的。特别是,Python 不会将它们与任何其他评论区别对待。
在Python中写评论时#
和#:
有什么区别?
'#'之后的所有内容都是注释,这只是品味问题。 小写、大写、驼峰写都可以,只要你看得懂你在评论什么。
如果你真的想评论你可以使用类似的东西:
#####################
###### TITLE ########
#####################
print 'hello world'
Flask 使用 Sphinx for documentation generation, and Sphinx uses #:
标记文档属性的注释:
For module data members and class attributes, documentation can either be put into a comment with special formatting (using a
#:
to start the comment instead of just#
), or in a docstring after the definition.
此外,来自 Flask 的 style guide:
If a comment is used to document an attribute, put a colon after the opening pound sign (
#
)
如果您没有使用像 Sphinx 这样理解 #:
的文档生成器,那么使用 #:
注释是没有意义的。特别是,Python 不会将它们与任何其他评论区别对待。