官术网_书友最值得收藏!

Comments

We believe docstrings are the right place for most documentation in Python code. They explain how to consume the facilities your module provides rather than how it works. Ideally your code should be clean enough that ancillary explanation is not required. Nevertheless, it's sometimes necessary to explain why a particular approach has be chosen or a particular technique used, and we can do that using Python comments. Comments in Python begin with # and continue to the end of the line.

As a demonstration, let's document the fact that it might not be immediately obvious why we're using sys.argv[1] rather than sys.argv[0] in our call to main():

if __name__ == '__main__':
main(sys.argv[1]) # The 0th arg is the module filename.
主站蜘蛛池模板: 南和县| 汉沽区| 巨鹿县| 资阳市| 兴城市| 宿松县| 桃园县| 德州市| 徐汇区| 桃园市| 阿拉善左旗| 通道| 海晏县| 禹城市| 乐陵市| 永清县| 安义县| 杂多县| 邯郸市| 尚志市| 浏阳市| 遵义市| 冕宁县| 汉源县| 山阴县| 会同县| 出国| 赣州市| 泰安市| 九江县| 长垣县| 和政县| 宁阳县| 晋宁县| 海林市| 新安县| 文昌市| 甘泉县| 滦南县| 文成县| 乳山市|