首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

The Zen of Python

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之禅

作者:蒂姆·彼得斯

美丽总比丑陋好

显式比隐式更好

简单比复杂好

复杂比繁杂好

平面优于嵌套

稀疏比稠密好

可读性将会提升

特殊情况并不足以打破规则

这样实用性更强

错误不应该是无声的

除非当面的沉默

面对模棱两可,拒绝猜测的诱惑

应该有一个,最好只有一个,明显的方法

尽管这方法开始可能并不明显,除非你是荷兰人

现在总比没有好

尽管从来没有比现在更好

如果这个实现很难解释,那就是个坏主意

如果这个实现很容易解释,那可能是个好主意

命名空间是一个伟大的想法

——让我们多做一些吧!

人生苦短,我用python。关注文教Crazy,持续更新,敬请期待!

  • 发表于:
  • 原文链接http://kuaibao.qq.com/s/20180319G1CNMG00?refer=cp_1026
  • 腾讯「腾讯云开发者社区」是腾讯内容开放平台帐号(企鹅号)传播渠道之一,根据《腾讯内容开放平台服务协议》转载发布内容。
  • 如有侵权,请联系 cloudcommunity@tencent.com 删除。

扫码

添加站长 进交流群

领取专属 10元无门槛券

私享最新 技术干货

扫码加入开发者社群
领券