pep8 && pep20
pep8(部分,遇到问题再补充)
1.不建议使用tab键来空格,避免不必要的空格。操作符左右各加一个空格,函数默认参数使用的赋值符左右省略空格。
2.类和top-level函数定义之间空两行;类中的方法定义之间空一行;函数内逻辑无关段落之间空一行;其他地方尽量不要再空行。
4.换行用反斜杠,建议用圆括号。
5.import部分,按标准、三方和自己编写顺序依次排放,之间空一行。
6.不建议在一句中import多个。
7.尽量用"is""is not"代替"=="
pep20
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
pep8 && pep20的更多相关文章
- python代码风格指南:pep8 中文版
本文档所提供的编码规范,适用于主要的Python发行版中组成标准库的Python代码.请参阅PEP关于Python的C实现的C编码风格指南的描述. 本文档和PEP257(文档字符串规范)改编自Guid ...
- vim python配置 安装pep8自动检查插件,语法高亮
pep8 http://www.vim.org/scripts/script.php?script_id=2914 语法高亮 http://www.vim.org/scripts/script.php ...
- python pep8
有这个自动的规范检查工具 pip install pep8 具体使用不说了 ==. 百度一堆 http://blog.sae.sina.com.cn/archives/4781 看这里
- pycharm 中 pep8 检查开启.
pycharm pep8检查的开启,默认是暗黄色,我这里为了醒目给改成了黄色.
- Python编程规范(PEP8)
Python编程规范(PEP8) 代码布局 缩进 对于每一次缩进使用4个空格.使用括号.中括号.大括号进行垂直对齐,或者缩进对齐. 制表符还是空格? 永远不要将制表符与空格混合使用.Python最常用 ...
- python代码风格指南:pep8 中文翻译
摘要 本文给出主Python版本标准库的编码约定.CPython的C代码风格参见PEP7.本文和PEP 257 文档字符串标准改编自Guido最初的<Python Style Guide&g ...
- 【转】python代码风格-PEP8
转载自http://www.douban.com/note/134971609/ Python 的代码风格由 PEP 8 描述.这个文档描述了 Python 编程风格的方方面面.在遵守这个文档的条件下 ...
- 老李分享:pep8 python代码规范
老李分享:pep8 python代码规范 什么是PEPPEP是 Python Enhancement Proposal 的缩写,翻译过来就是 Python增强建议书 . PEP8 译者:本文基于 20 ...
- PEP8
1.规则要求 https://www.python.org/dev/peps/pep-0008 2.工具 https://github.com/jcrocholl/pep8 3.基本使用方法 测试自己 ...
随机推荐
- Centos代理上网设置
原文链接:http://m.blog.csdn.net/article/details?id=51851677 一.centos自带界面设置代理 1. 界面设置 squid默认代理端口3128. 2 ...
- Python集合的基本操作
#-*coding:utf-8 -* list =set([2,3,4]) list2 =set([5,3,7]) #交集 #print (list.intersection(list2)) #并集 ...
- unity Flash Animation Toolset插件使用
插件网站:http://matov.me/flash-animation-toolset/ 1.在unity上打开资源商店,Window -> Asset Store -> 搜索Flash ...
- C#使用MonoPInvokeCallback,让C直接回调C#函数
Test.mm char* TestMakeCString(NSString *str) { const char* string = [str UTF8String]; if (string == ...
- C++“隐藏实现,开放接口”的实现方案
为什么要有接口? 接口就是一个程序与其它程序交流的窗口.就比如有一个电视机,我并不需要知道它是怎样工作的,我只要知道按电源键就可以开启电视,按节目加(+)减(-)可以切换电视频道就可以了. Java程 ...
- CHAR 和VARCHAR的区别
CHAR(10)是不可变长度为10的字符串,占的存储空间始终为10个字符的长度,而VARCHAR(10)是可变长度的字符串,故而可以节省空间.例如:储存"aaaaabbbbb",则 ...
- mac使用brew安装sshpass
brew安装sshpass brew install https://raw.githubusercontent.com/kadwanev/bigboybrew/master/Library/Form ...
- ANg-线性回归算法
线性回归算法 linear regression 对于线性回归模型,我们期望对于样本数据集,通过假设函数,得出目标值 代价函数 m在这里指的是训练样本的数量 所以我们的目的就是得出代价函数(平方误差代 ...
- platform 系统是windows还是liunx
import platform # 判断当前代码运行的系统是windows还是liunx print(platform.architecture()) print(platform.platform( ...
- MongoDB常用查询,排序,group,SpringDataMongoDB update group
MongoDB查询 指定查询并排序 db.getCollection('location').find({"site.id":"川A12345","s ...