文章目录
前言
禅,是人类锻炼思维生发智慧的生活方式;禅,是一种基于“静”的行为,源于人类本能,经过古代先民开发,形成各种系统的修行方法,并存在于各种教派。先秦时期就有关于此种行为的记载,但是未有固定称呼。直至印度词汇jana传入,汉语音译为“禅那”,后世便以“禅”字称谓此类行为”。(百度百科)
那么传说中的Python之禅是什么呢,python之禅就是指python的修行方法。其真正的意义还需要诸位在Python的使用中慢慢参悟。
Python之禅
- 来自于Python的官方格言,也就是俗称的Python之禅。
- 在Python的IDLE或者交互式解释器中,输入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