Import this—Python的设计原则

简介:     在python交互解释器中输入“Import this”,就会出现Python的设计原则: 点击(此处)折叠或打开 >>> import this The Zen...
    在python交互解释器中输入“Import this”,就会出现Python的设计原则:

点击(此处)折叠或打开

  1. >>> import this
  2. The Zen of Python, by Tim Peters

  3. Beautiful is better than ugly.
  4. Explicit is better than implicit.
  5. Simple is better than complex.
  6. Complex is better than complicated.
  7. Flat is better than nested.
  8. Sparse is better than dense.
  9. Readability counts.
  10. Special cases aren't special enough to break the rules.
  11. Although practicality beats purity.
  12. Errors should never pass silently.
  13. Unless explicitly silenced.
  14. In the face of ambiguity, refuse the temptation to guess.
  15. There should be one-- and preferably only one --obvious way to do it.
  16. Although that way may not be obvious at first unless you're Dutch.
  17. Now is better than never.
  18. Although never is often better than *right* now.
  19. If the implementation is hard to explain, it's a bad idea.
  20. If the implementation is easy to explain, it may be a good idea.
  21. Namespaces are one honking great idea -- let's do more of those!

相关文章
|
2月前
|
数据可视化 数据挖掘 开发者
import有什么用,python中怎么使用import
import有什么用,python中怎么使用import
27 1
|
5月前
|
API Python
python 详细理解 import ---- openstack自动import class 到 特定命名空间
python 详细理解 import ---- openstack自动import class 到 特定命名空间
48 0
|
2月前
|
Python
[Python] 如何用import导入模块
[Python] 如何用import导入模块
24 0
|
4月前
|
C++ Python
python工程中import要点提炼
python工程中import要点提炼
|
4月前
|
Python
Python小姿势 - import random
Python小姿势 - import random
|
4月前
|
Python
Python小姿势 - import requests
Python小姿势 - import requests
|
5月前
|
开发者 Python
【python】tkinter组件,from Tkinter import * 与 import Tkinter 的区别
【python】tkinter组件,from Tkinter import * 与 import Tkinter 的区别
56 0
|
5月前
|
编译器 Python
Python 完美解决 Import "模块" could not be resolved ...
Python 完美解决 Import "模块" could not be resolved ...
51 0
|
5月前
|
XML 数据格式 Python
Python解释import、from ... import ... 和 from ... import *的区别。
解释import、from ... import ... 和 from ... import *的区别。
|
6月前
|
Linux 开发工具 C++
【vcpkg】像Python一样方便的import 自己的c++库
使用此种方式可无需设置 CMAKE_TOOLCHAIN_FILE 即可使用 vcpkg,且更容易完成配置工作。
207 0