问题描述
我在有关Python编码指南的文档中遇到了Python源文件的以下头文件格式:
#!/ usr / bin / env python
foobar.py:foobar的说明。
__author__ =Barack Obama
__copyright__ =版权所有2009,地球
这是Python世界中标题的标准格式吗?
我可以在标题中放置什么其他字段/信息?
Python gurus分享您的Python源标头的指南: - )
$ c> foobar 模块。
第一个是模块的 docstring
,这已在中解释过。 / p>
您有更多信息,列出 __ author __
, __作者__
, __ contact __
, __ copyright __
, __license __
, __ deprecated __
, __ date __
和 __ version __
作为已识别的元数据。
I came across the following header format for Python source files in a document about Python coding guidelines:
#!/usr/bin/env python
"""Foobar.py: Description of what foobar does."""
__author__ = "Barack Obama"
__copyright__ = "Copyright 2009, Planet Earth"
Is this the standard format of headers in the Python world?What other fields/information can I put in the header?Python gurus share your guidelines for good Python source headers :-)
Its all metadata for the Foobar
module.
The first one is the docstring
of the module, that is already explained in Peter's answer.
Here you have more information, listing __author__
, __authors__
, __contact__
, __copyright__
, __license__
, __deprecated__
, __date__
and __version__
as recognized metadata.
这篇关于Python文件的常见头格式是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!