亿迅智能制造网
工业4.0先进制造技术信息网站!
首页 | 制造技术 | 制造设备 | 工业物联网 | 工业材料 | 设备保养维修 | 工业编程 |
home  MfgRobots >> 亿迅智能制造网 >  >> Industrial programming >> Python

Python 之禅:19 条永恒编程箴言(PEP 20)

Python 之禅:19 条永恒编程箴言(PEP 20)

最早的 Python PEP 之一是 PEP-20,列出 19 条 Python 编程箴言,名为“Python 之禅”。规则源自 2004 年,基于 PEP-8。

Python 内置彩蛋可直接打印这 19 条:

>>> import this
The Zen of Python, by Tim Peters
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!

只要有 Python REPL,随时可调出这 19 条箴言!

Python

  1. B&R mapp Motion新增高级配置功能,提升机器人性能
  2. 供应链未来防务:韧性与增长的双重策略
  3. 疫情挑战下的核心物资协同采购
  4. IoT 如何重塑 HVAC:五大关键改进
  5. 物联网:企业增长的真正“金钥匙”,还是只会下金蛋的鹅?
  6. 深化物联网洞察:善用数据可视化与图数据库
  7. 联网汽车如何革新车辆安全与维护
  8. 精通Python数据类型:实战指南
  9. 精通Python运算符:全面指南
  10. Python 列表操作:创建、访问、修改与进阶技巧
  11. 精通 Python 元组:创建、访问与进阶操作
  12. 精通 Python 字典:创建、操作与进阶技巧