Python之禅

输入如下代码后,会出现有趣的结果!

import this

结果如下:

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!

译文如下:

以编写优美代码为目标,不多解释

优美代码应该清晰明了,规范统一

优美代码应该逻辑简洁,避免复杂逻辑

如果必须采用复杂逻辑,接口关系也要清晰

优美代码应该是扁平的,避免太多层次嵌套

优美代码间隔要适当,每行代码解决适度问题

优美代码必须是可读且易读的

上述规则是至高无上的

捕获异常,不让程序留有因错误退出的可能

不要试图给出多种方案,找到一种实现它,几乎所有人都没有Guido那么牛

编程之前要有思考

能说清楚的往往才是对的

适合复杂程序编程

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

程序员班长

感谢您的一路相伴

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值