Python简介
1. 背景介绍
1.1 Python的诞生
1.1.1 诞生背景
Python是著名的Guido van Rossum在1989年圣诞节期间,为了打发无聊的圣诞节而编写的一个编程语言。
作者是受到了ABC的启发,然后根据自己的想法改进创建的python
1.1.2 作者介绍
Guido van Rossum
1.1.3 名称由来
作者喜欢的一个节目命名(**马戏团)
1.2 Python近期的发展
1.2.1 在运维界的兴起
- devops,运维自动化(一些运维自动化工具是用python设计的)
- 云计算、大数据兴起(openstack,numpy, pandas,ipython)
- 创业潮,开发效率高(开发效率大于产品性能)
1.2.2 2和3的分裂?
2是遗留,3是未来
2和3的主要区别
six module、future(timemachine)等用于兼容
1.3 Python语言介绍
1.3.1 什么是脚本语言
- 语法和结构通常比较简单
- 学习和使用通常比较简单
- 通常以容易修改程序的”解释”作为运行方式,而不需要”编译”
- 程序的开发产能优于运行性能
1.3.2 JIT是什么
Just in time
1.3.3 Python的应用范围
- 首选是web开发;
- 其次是批处理脚本;
- 另外就是胶水语言,和其他语言混用;
- 然后还有大数据分析;
- 最后是用于教学和科学研究。
1.4 Python的实现
1.4.1 关于CPython
通常我们讲的python就是CPython,解释器是C语言
1.4.2 关于其他
- JPython:JVM
- PYPY:JIT、Rpython
- IronPython:.net
1.4.3GIL的问题
GIL:Global interpreter lock
作用:使得同时只有一个线程在执行
不影响:IO,多线程爬虫,IO密集型
解决办法:多进程方式
1.5 新手必读
1.5.1 社区状态
1.5.2 如何查找资料
https://doc.python.org/2.7
1.5.3 如何混社区\到哪问问题
- stackoverflow
- reddit
- mail list
2. 扩展阅读
2.1 devops
DevOps(英文Development和Operations的组合)是一组过程、方法与系统的统称,用于促进开发(应用程序/软件工程)、技术运营和质量保障(QA)部门之间的沟通、协作与整合。
2.2 openstack
OpenStack是一个美国国家航空航天局和Rackspace合作研发的云端运算?软件,以Apache许可证授权,并且是一个自由软件和开放源代码项目。
penStack是IaaS(基础设施即服务)?软件,让任何人都可以自行建立和提供云端运算服务。
2.3 numpy
NumPy is the fundamental package for scientific computing with Python.
2.4 pandas
pandas is an open source, BSD-licensed library providing high-performance, easy-to-use data structures and data analysis tools for the Python programming language.
2.5 ipython
IPython是一种基于Python的交互式解释器。相较于原生的Python Shell,IPython提供了更为强大的编辑和交互功能。
IPython拥有一套复杂的并行和分配计算结构。IPython使得各种并行应用能够交互式的被开发、执行、调试和监控。因此IPython中的”I”代表”交互”。
2.6 six
Six is a Python 2 and 3 compatibility library. It provides utility functions for smoothing over the differences between the Python versions with the goal of writing Python code that is compatible on both Python versions.
2.7 future
future is a real module, and serves three purposes:
- To avoid confusing existing tools that analyze import statements and expect to find the modules they’re importing.
- To ensure that future statements run under releases prior to 2.1 at least yield runtime exceptions (the import of future will fail, because there was no module of that name prior to 2.1).
- To document when incompatible changes were introduced, and when they will be - or were - made mandatory. This is a form of executable documentation, and can be inspected programmatically via importing future and examining its contents.