官术网_书友最值得收藏!

Python versions

At the time of writing this book in early 2017, Python is going through a transition period of moving from Python version 2 to Python version 3. Unfortunately Python 3 is not backward compatible with Python 2. When I say transition, keep in mind that Python 3 was released back in 2008, over nine years ago with active development with the most recent release of 3.6. The latest Python 2.x release, 2.7, was released over six years ago in mid 2010. Fortunately, both version can coexist on the same machine. Personally, I use Python 2 as my default interpreter when I type in Python at the Command Prompt, and I use Python 3 when I need to use Python 3. More information is given in the next section about invoking Python interpreter, but here is an example of invoking Python 2 and Python 3 on the Ubuntu Linux machine:

    echou@pythonicNeteng:~$ python
Python 2.7.12 (default, Nov 19 2016, 06:48:10)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for
more information.
>>> exit()
    echou@pythonicNeteng:~$ python3
Python 3.5.2 (default, Nov 17 2016, 17:05:23)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for
more information.
>>> exit()

With the 2.7 release being end of life on extended support only for security updates, most Python frameworks are now supporting Python 3. Python 3 also has lots of good features such as asynchronous I/O that can be taken advantage of when we need to optimize our code. This book will use Python 3 for its code examples.

If the particular library or the framework does not support Python 3, such as Ansible (they are actively working on porting to Python 3), it will be pointed out, so you can use Python 2 instead.

主站蜘蛛池模板: 遂溪县| 本溪市| 黑河市| 山东| 嘉祥县| 承德市| 武宣县| 从江县| 黑河市| 邹平县| 泰宁县| 景德镇市| 遂宁市| 互助| 兴化市| 桐乡市| 东方市| 土默特右旗| 紫云| 泸州市| 咸阳市| 荥阳市| 额济纳旗| 达日县| 二连浩特市| 黑水县| 八宿县| 新昌县| 扶风县| 新巴尔虎右旗| 罗山县| 永宁县| 鄯善县| 大连市| 永康市| 兴安盟| 庄河市| 武宁县| 泰宁县| 桃江县| 买车|