Python 语言介绍

2019-04-21  本文已影响0人  finlu

Python语言的历史

python诞生于1991年,至今也有二十多年的历史了,可以算得上是一门比较 “古老的” 程序设计语言。Python作为一门古老的程序设计语言,它的应用非常广泛,在系统管理、科学计算、Web应用程序、嵌入式系统等各个方面都可以看到Python的影子。

Python语言的版本及特性

Python分两个大的版本:python2和python3(目前大多数人使用)。Python3中增加了许多令人期盼的新功能,其中最令人注目的是Unicode的支持,将str和unicode进行了整合,并明确地提供了另一个bytes类型,解决了许多人处理字符编码的问题。Python3.x的一些其他新特性:Python3.3 中支持了u'foo'来表示unicode字符串b'foo'来表示bytes字符串......

​ 由于python2的存在时间比较长,所以以前很多项目都是使用python2进行开发的。如果你想在python2中就使用python3.x中的一些特性,可以试着通过from __future__import来使用想使用的模块,例如使用from __future__import print_function就可以使用Python3.x中的print()函数,以兼容的方式来编写输出语句。

Python社区

Python之父 -- Guido van Rossum

Guido是首位享有BDFL封号的开放源码(简称开源)软件创建者,BDFL全名为Benevolent Dictator For Life,中文常译为 “仁慈的独裁者”,意思是拥有这类称号的开源软件创建者,对社区仍持续关注,在必要时能对社区中的意见和争议提出想法并作出最后的裁决。

Python软件基金会

Python Software Foundation常简称为 PSF,主要任务是推广、维护与促进Python程序设计语言的发展,同时也支持和协助全球各地各种各样Python程序设计师与Python社区的成长。PSF是非盈利组织,持有对Python程序设计语言的知识产权。

Python改进提案

Python Enhancement Proposals 常简称为PEPs,Python的改进多是由PEP流程主导,PEP流程会收集来自Python社区的意见。

Python哲学

在命令提示符中输入python -c "import this"或者在Python Shell输入import this就会出现一段话,这就是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!
上一篇下一篇

猜你喜欢

热点阅读