资讯专栏INFORMATION COLUMN

PEP 20 -- The Zen of Python

derek_334892 / 369人阅读

共勉

  

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!

彩蛋
>>> import this

文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。

转载请注明本文地址:https://www.ucloud.cn/yun/37455.html

相关文章

  • 学习Python,怎能不懂点PEP呢?

    摘要:或许你是一个初入门的小白,完全不知道是什么。到目前为止,它拥有个兄弟姐妹。此外,关于对的贡献,还有一种很有效的方式,就是将翻译成中文,造福国内的学习社区。 或许你是一个初入门Python的小白,完全不知道PEP是什么。又或许你是个学会了Python的熟手,见过几个PEP,却不知道这玩意背后是什么。那正好,本文将系统性地介绍一下PEP,与大家一起加深对PEP的了解。 目前,国内各类教程不...

    Magicer 评论0 收藏0
  • PyCharm使用autopep8按PEP8风格自动排版Python代码

    摘要:应该提供一种,且最好只提供一种,一目了然的解决方案当然这是没法一蹴而就的,除非你是荷兰人固然,立刻着手好过永远不做。简而言之就是整个项目周期中越早暴露的问题,其修复成本越低本文作者解释说这里的荷兰人指的是的作者 前言 autopep8是一个将Python代码自动排版为PEP8风格的小工具。它使用pep8工具来决定代码中的哪部分需要被排版。autopep8可以修复大部分pep8工具中报告...

    Sanchi 评论0 收藏0

发表评论

0条评论

最新活动
阅读需要支付1元查看
<