Skip to content

Latest commit

 

History

History
 
 

01.Python

本目录是 Python 相关笔记

原生内容

安装
基础语法
进阶语法
内置变量函数
内置模块
第三方模块

web开发

WSGI
Gevent
gunicorn

fast api
tornado
Django
flask
CherryPy
微信公众号

数据库

redis
PyMongo
MongoEngine
pandas

Python之禅
The Zen of Python, by Tim Peters (import this 语句可以打印出来)

优美胜于丑陋。
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.

所有错误都不应该被直接忽略,除非能够被精确的捕获之后。(其中一个典型的例子就是,不建议用Exception:pass来直接忽略所有异常。)
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.
尽管起初,那种解决方案可能并不是那么显而易见,因为你不是 Python 之父(这里的Dutch是指Python之父Guido Van Rossum,他是荷兰人。)
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!

注:翻译参考了网上流行的一些译文