命名规则
名称不要缩写!!!
名称不要缩写!!!文章源自懂站帝-http://www.sfdkj.com/12800.html
名称不要缩写!!!文章源自懂站帝-http://www.sfdkj.com/12800.html
包命名:小写,下划线_连接单词文章源自懂站帝-http://www.sfdkj.com/12800.html
模块命名:小写,下划线_连接单词文章源自懂站帝-http://www.sfdkj.com/12800.html
类命名:双驼峰,MyClass文章源自懂站帝-http://www.sfdkj.com/12800.html
函数命名:小写,下划线_连接单词文章源自懂站帝-http://www.sfdkj.com/12800.html
全局变量:每个字母大写文章源自懂站帝-http://www.sfdkj.com/12800.html
注释风格
注释很重要,要注明函数或类的功能,参数的数据类型、含义等。文章源自懂站帝-http://www.sfdkj.com/12800.html
注释模板:文章源自懂站帝-http://www.sfdkj.com/12800.html
'''All properties or methods that a function described文章源自懂站帝-http://www.sfdkj.com/12800.html
Parameters:文章源自懂站帝-http://www.sfdkj.com/12800.html
------文章源自懂站帝-http://www.sfdkj.com/12800.html
Args: type文章源自懂站帝-http://www.sfdkj.com/12800.html
description文章源自懂站帝-http://www.sfdkj.com/12800.html
Return:文章源自懂站帝-http://www.sfdkj.com/12800.html
------文章源自懂站帝-http://www.sfdkj.com/12800.html
variables: type文章源自懂站帝-http://www.sfdkj.com/12800.html
descripton文章源自懂站帝-http://www.sfdkj.com/12800.html
'''文章源自懂站帝-http://www.sfdkj.com/12800.html
注释的作用:文章源自懂站帝-http://www.sfdkj.com/12800.html
- 注释要按格式写清楚,写全,避免在团队开发过程中不必要的沟通成本。
- 在开发过程中,结合代码调试的结果和注释可以很快发现问题所在。
如何提高Python代码的可重复性?
Python有句话是do not repeat yourself,即不要做重复的事,因此出现了类或函数的封装和继承,基于此可提高代码的重复利用性。