Python的设计哲学--zen of Python
Python的设计哲学--zen of Python
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.虽然这种 方式可能不容易,除非你是python之父
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 之禅,Guido van Rossum一定是个有趣的人,能将设计思想展现在python解释器中,在“hello world”程序开始之前,它还有一番人生哲学啊
Python的设计哲学--zen of Python的更多相关文章
- Python的设计哲学探究
在Python shell中输入import this就会在屏幕上打印出来Python的设计哲学,如下: In [25]: import this The Zen of Python, by Tim ...
- Python的设计哲学
Beautiful is better than ugly. 优美胜于丑陋 Explicit is better than implicit. 明了胜于晦涩 Simple is better than ...
- Python基础教程(004)--Python的设计哲学
前言 Python已经成为了一门流行的编程语言. 知识点 1,优雅 2,明确 3,简单 Python开发者的哲学是:用一种方法,最好是只有一种方法来做一件事. 如果面临多种选择,Python开发者都会 ...
- python之禅 the zen of python
>>> import this The Zen of Python, by Tim Peters Beautiful is better than ugly. Explicit is ...
- Python import this : The Zen of Python
>>> import thisThe Zen of Python, by Tim Peters Beautiful is better than ugly.Explicit is b ...
- 什么是Python?Python的设计哲学?如何获取/升级Python?
Python? Python(英国发音:/ˈpaɪθən/ 美国发音:/ˈpaɪθɑːn/) Python的创始人为吉多·范罗苏姆(Guido van Rossum). 1989年的圣诞节期间,吉多· ...
- funny_python 00 The Zen of Python
# 打算每天多动的时候尽量搜索一些和coding相关的funny stuff Day 00 - PEP 20 The Zen of Python 在shell里面输入python -m this 回车 ...
- Go for Pythonistas Go and the Zen of Python 禅
Go for Pythonistas https://talks.golang.org/2013/go4python.slide#1 Things I don't like about Python ...
- ######【Python】【基础知识】Python的介绍 ######
Python 是一种面向对象.解释型计算机程序设计语言. Python是什么? Python(英国发音:/ˈpaɪθən/ 美国发音:/ˈpaɪθɑːn/), 是一种面向对象的解释型计算机程序设计语言 ...
随机推荐
- composer install 出现“Please provide a valid cache path”
本文背景:通过deployer部署PHP项目[deployer部署工具:https://deployer.org/] 问题:Php 的laravel框架中执行 composer install 后, ...
- 【Mysql】了解Mysql中的启动参数和系统变量
一.启动参数 在程序启动时指定的设置项也称之为启动选项(startup options),这些选项控制着程序启动后的行为. 1)在命令行上使用选项 启动服务器程序的命令行后边指定启动选项的通用格式就是 ...
- sed 常用命令 网址
https://wangchujiang.com/linux-command/c/sed.html https://linux.cn/article-11367-1.html https://juej ...
- springboot+springmvc拦截器做登录拦截
springboot+springmvc拦截器做登录拦截 LoginInterceptor 实现 HandlerInterceptor 接口,自定义拦截器处理方法 LoginConfiguration ...
- Netty的常用API(二)
在使用Netty之前先介绍下Netty的常用API,对其有一个大概的了解. 一.EventLoop和EventLoopGroup EventLoop如同它的名字,它是一个无限循环(Loop),在循环中 ...
- SSH登录服务器慢
最近频繁遇到ssh登录到服务器验证慢的这个问题,今天抽时间总结下原因以及解决办法. UseDNS 登录到服务器端查看sshd_config配置文件,当UseDNS项配置为yes时(默认情况下可 ...
- polynote 安装试用
polynote 是netflix 开源的一个notebook 工具(支持scala,python,sql ...) 下载安装包 https://github.com/polynote/polynot ...
- 生成指定python项目中所有的依赖文件
一. pipreqs工具 这个工具的好处是可以通过对项目目录的扫描,自动发现使用了那些类库,自动生成依赖清单. 缺点是可能会有些偏差,需要检查并自己调整下. 安装: pip install pipre ...
- requests获取图片的宽和高
try: if cover: resp = requests.get('%s?x-oss-process=image/info' % (url), timeout=30) if resp.status ...
- [LeetCode] 44. Wildcard Matching 外卡匹配
Given an input string (s) and a pattern (p), implement wildcard pattern matching with support for '? ...