Python之禅

import this

这是 Python 社区中著名的 "The Zen of Python"(Python之禅)文档,由 Python 创始人之一的 Tim Peters 撰写。这个文档包含了一系列关于编程和代码设计哲学的原则,以指导 Python 社区的开发者。以下是这些原则的简要解释:

  1. Beautiful is better than ugly.

    善美胜过丑陋。
  2. Explicit is better than implicit.

    明确胜过隐晦。
  3. Simple is better than complex.

    简单胜过复杂。
  4. Complex is better than complicated.

    复杂胜过错综复杂。
  5. Flat is better than nested.

    扁平胜过嵌套。
  6. Sparse is better than dense.

    疏朗胜过紧密。
  7. Readability counts.

    可读性至关重要。
  8. Special cases aren't special enough to break the rules.

    特殊情况也不足以违反规则。
  9. Although practicality beats purity.

    尽管实用性胜过纯粹性。
  10. Errors should never pass silently.错误不应悄悄地忽略过去。

  11. Unless explicitly silenced.

    除非明确地进行了消除。
  12. In the face of ambiguity, refuse the temptation to guess.

    面对不确定性,拒绝猜测的诱惑。
  13. There should be one-- and preferably only one --obvious way to do it.

    应该有一种,最好只有一种明显的做法。
  14. Although that way may not be obvious at first unless you're Dutch.

    尽管这种方式一开始可能并不明显,除非你是荷兰人。
  15. Now is better than never.

    现在胜过永远不开始。
  16. Although never is often better than right now.

    尽管永远比眼下马上更好。
  17. If the implementation is hard to explain, it's a bad idea.

    如果实现难以解释,那就是个糟糕的主意。
  18. If the implementation is easy to explain, it may be a good idea.

    如果实现容易解释,那可能是个好主意。
  19. Namespaces are one honking great idea -- let's do more of those!

    命名空间是一个了不起的想法 — 让我们做更多这样的事情!

这些原则代表了 Python 社区在编写代码时的一些建议和价值观,旨在鼓励代码的清晰、简洁和易读。

相关推荐

  1. Python

    2023-12-15 15:38:01       53 阅读
  2. 软件(十一) 消息

    2023-12-15 15:38:01       35 阅读
  3. Centos7.6道开源版17.6.1安装记录

    2023-12-15 15:38:01       49 阅读
  4. Pythonpython-socketio

    2023-12-15 15:38:01       63 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2023-12-15 15:38:01       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2023-12-15 15:38:01       101 阅读
  3. 在Django里面运行非项目文件

    2023-12-15 15:38:01       82 阅读
  4. Python语言-面向对象

    2023-12-15 15:38:01       91 阅读

热门阅读

  1. PHP的协程是什么?

    2023-12-15 15:38:01       65 阅读
  2. MFC Picture控件显示图片并适应控件大小

    2023-12-15 15:38:01       53 阅读
  3. 小程序跳转按钮

    2023-12-15 15:38:01       46 阅读
  4. Linux---终端命令格式的组成

    2023-12-15 15:38:01       54 阅读
  5. Android Binder 调用栈

    2023-12-15 15:38:01       50 阅读
  6. 如何测试Nginx防盗链是否生效?

    2023-12-15 15:38:01       57 阅读
  7. 《Kotlin核心编程》笔记:面向表达式编程

    2023-12-15 15:38:01       57 阅读
  8. 浅谈EC防御技术

    2023-12-15 15:38:01       61 阅读
  9. 开发人员必用的Linux命令,建议收藏

    2023-12-15 15:38:01       67 阅读
  10. nvm动态管理node.js

    2023-12-15 15:38:01       69 阅读
  11. MySQL高可用实战(MHA)

    2023-12-15 15:38:01       45 阅读
  12. 自定义kafka客户端消费topic

    2023-12-15 15:38:01       64 阅读
  13. C++入门【5-C++ 常量】

    2023-12-15 15:38:01       49 阅读