ITPub博客

首页 > 应用开发 > IT综合 > Import this—Python的设计原则

Import this—Python的设计原则

原创 IT综合 作者:路途中的人2012 时间:2016-03-30 22:45:55 0 删除 编辑
    在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!

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29067253/viewspace-2072710/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: 博客链接—杂烩
请登录后发表评论 登录
全部评论

注册时间:2015-01-08

  • 博文量
    495
  • 访问量
    768406