在Python的禅中,我可以理解它的大部分部分,除了:
Now is better than never.
Although never is often better than *right* now
所以我认为现在就做或者现在就取得结果总比没有好。但是为什么“从来没有比现在更好?”?或者这是什么意思?
要在上下文中看到上面的2行,这是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!
发布于 2016-02-12 22:55:47
第一部分,“现在总比没有好”,是一个反对拖延的咒语。它表达了这样的想法:如果你不去做它,你就永远不会有时间去做它。
第二部分“永远不会比现在更好”是雅格尼原则的一种表达。它的理念是,“当你真正需要的时候,永远不要去实现它们,当你只是预见到你需要它们时,永远不要去实现它们”,因为你常常发现你根本不需要它们,然后发现你只是在浪费精力。
..。这就是我的理解。但你得让作者确定。
发布于 2016-02-12 22:26:13
这可能是关于懒惰的评价。
示例:
xrange(1000000)
vs
range(1000000)
其中,第一个在需要值之前不会做很多事情,但是后者分配一个大数组。
或伐木
log("Stuff happened for %s ", something)
vs
log("Stuff happened for %s " % something)
其中第一个不生成字符串,除非实际启用日志记录。
发布于 2016-02-14 10:41:24
我认为,这些适用于语言设计过程本身,而不仅仅是应用程序。“现在总比没有好。”“虽然从来没有比现在更好”就是要在时间和质量上找到适当的平衡。禅宗的其余部分也是如此。当然,从设计上来说,禅宗没有任何意义。
https://softwareengineering.stackexchange.com/questions/310015
复制相似问题