python名言(python界的名句)

1年前 (2023-08-28)阅读216回复0
阁瑞斯
阁瑞斯
  • 注册排名10018
  • 经验值0
  • 级别
  • 主题0
  • 回复0
楼主

Python 语言之禅:

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 语言之禅是 Python 社区的一个非常经典的文化符号,它总结了 Python 这门语言的核心哲学。其中,对于代码简洁和可阅读性的强调,成为了 Python 界的名言。

这个文本片段中的内容,涵盖了 Python 社区所推崇的许多理念,如:

  • 优美优于丑陋
  • 明确优于暗示
  • 简单优于复杂
  • 复杂优于晦涩
  • 平直优于嵌套
  • 宽松优于密集
  • 可读性很重要
  • 特殊情况没有特殊规则
  • 实用性胜于纯粹性
  • 错误不能悄悄地通过
  • 需要明确地声明抑制错误
  • 面对模棱两可,拒绝猜测
  • 应当有一种,且最好是仅有一种,显而易见的写法
  • 现在开始做优于稍后尝试做
  • 尽管后者常常比前者好,但“不做”通常比“随意做”更好
  • 如果实现很难解释,那它就是个坏主意
  • 如果实现容易解释,那它可能是个好主意
  • 命名空间是个非常好的想法,请多加支持

本文可能转载于网络公开资源,如果侵犯您的权益,请联系我们删除。

本文地址:https://www.pyask.cn/info/77.html

0
回帖

python名言(python界的名句) 期待您的回复!

取消
载入表情清单……
载入颜色清单……
插入网络图片

取消确定

图片上传中
编辑器信息
提示信息