Python之禅,代码如何写出禅意?来自Python的官方介绍。


前言

禅,是人类锻炼思维生发智慧的生活方式;禅,是一种基于“静”的行为,源于人类本能,经过古代先民开发,形成各种系统的修行方法,并存在于各种教派。先秦时期就有关于此种行为的记载,但是未有固定称呼。直至印度词汇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

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值