168
說明: 寫點關於 Python 3 的參考
|
3039
yeild -> yield
|
這個顏色代表刪除的 | 這個顏色代表增加的 |
行號 1: | 行號 1: |
== 為什麼要用 Python 3? == | 目前這裡主要是在比較 Python 2 系列與 Python 3 系列。 |
行號 3: | 行號 3: |
* [[http://blog.nccu.edu.tw/blog/53560/365|Python 3 強力中文處理能力|target="_blank"]] on 炎龍老師的 Blog,2009.09 | == 為什麼要用(學)Python 3? == * 比較新。 * 更強大更方便的語法 * {{{x, *y, z = range(5)}}} * {{{nonlocal}}} * {{{yield from}}} * 更強大更方便的函式庫 * concurrent.futures (3.2) * argparse (3.2) * unittest.mock (3.3) * venv (3.3) * ipaddress (3.3) * enum (3.4) * asyncio (3.4) * statistics (3.4) * 更強大更不方便的 {{{print}}} * 之後不用再學一次 Python 3 的語法(但前提是不會需要寫到 Python 2 的程式)。 * Python 3 是目前官方持續開發(加新功能)的版本。 * Python 2 最後一個開發版本將維持在 2.7.2,並且不會再有新版(不再加新功能),除非有重大安全才會釋出安全更新版。 * 許多函式庫已經完成 Python 3 的移植。 * 更完整的 Unicode 處理能力。例: * [[http://blog.nccu.edu.tw/blog/53560/365|Python 3 強力中文處理能力|target="_blank"]] on 炎龍老師的 Blog,2009.09 * [[http://slott-softwarearchitect.blogspot.com/2012/01/python-32-csv-module-very-very-nice.html|Python 3.2 CSV Module -- Very, very nice|target="_blank"]] by S.Lott,2012.1.17 * 正在進行式: * [[https://fedoraproject.org/wiki/Changes/Python_3_as_Default|Changes/Python 3 as Default - FedoraProject|target="_blank"]] * "a release goal for Ubuntu 14.04 LTS to have only Python 3 on the desktop CD images" - [[https://wiki.ubuntu.com/Python/3|Python/3 - Ubuntu Wiki|target="_blank"]] == 為什麼不用(學)Python 3 == * 沒有權限去安裝、編譯或升級系統套件 * 許多函式庫尚未完成 Python 3 的移植。 * 目前尚非各平台內建版本(因為上一點)。 * 本身有特殊需求(例如新工作裡要接手的大量程式都已用 Python 2 完成)、需要用到 Jython(目前停留在 2.5)、Google App Engine(GAE 目前到 2.7)。 == 參考 == * [[http://pingyeh.blogspot.com/2008/12/python-30.html|Python 3.0 的新玩意(第一部)|target="_blank"]] on Ping不見路,2008.12 * [[http://www.arthurtoday.com/2011/12/ubuntu-python-3.html|Ubuntu 安裝 Python 3|target="_blank"]] on 阿舍的隨手記記、隨手寫寫...,2011.12 * [[http://blog.roodo.com/thinkingmore/archives/16141831.html|Python 2 與 3 之字串與檔案|target="_blank"]] on Thinking more...,2011.07 === 外文參考 === * [[http://nedbatchelder.com/blog/201310/whats_in_which_python_3.html|Ned Batchelder: What's in which Python 3?|target="_blank"]] * [[http://python3wos.appspot.com/|Python 3 Wall of Shame|target="_blank"]] 熱門套件有沒有上 Python 3 的表(婊XD)。 * Python 官網: * [[http://docs.python.org/py3k/whatsnew/3.0.html|What's new in Python 3.0|target="_blank"]] * [[http://wiki.python.org/moin/Python2orPython3|Python 2 or Python 3|target="_blank"]] * [[http://diveintopython3.ep.io/|Dive Into Python 3|target="_blank"]] by Mark Pilgrim,2011 |
目前這裡主要是在比較 Python 2 系列與 Python 3 系列。
為什麼要用(學)Python 3?
- 比較新。
- 更強大更方便的語法
x, *y, z = range(5)
nonlocal
yield from
- 更強大更方便的函式庫
- concurrent.futures (3.2)
- argparse (3.2)
- unittest.mock (3.3)
- venv (3.3)
- ipaddress (3.3)
- enum (3.4)
- asyncio (3.4)
- statistics (3.4)
更強大更不方便的 print
- 之後不用再學一次 Python 3 的語法(但前提是不會需要寫到 Python 2 的程式)。
- Python 3 是目前官方持續開發(加新功能)的版本。
- Python 2 最後一個開發版本將維持在 2.7.2,並且不會再有新版(不再加新功能),除非有重大安全才會釋出安全更新版。
- 許多函式庫已經完成 Python 3 的移植。
- 更完整的 Unicode 處理能力。例:
Python 3 強力中文處理能力 on 炎龍老師的 Blog,2009.09
Python 3.2 CSV Module -- Very, very nice by S.Lott,2012.1.17
- 正在進行式:
"a release goal for Ubuntu 14.04 LTS to have only Python 3 on the desktop CD images" - Python/3 - Ubuntu Wiki
為什麼不用(學)Python 3
- 沒有權限去安裝、編譯或升級系統套件
- 許多函式庫尚未完成 Python 3 的移植。
- 目前尚非各平台內建版本(因為上一點)。
- 本身有特殊需求(例如新工作裡要接手的大量程式都已用 Python 2 完成)、需要用到 Jython(目前停留在 2.5)、Google App Engine(GAE 目前到 2.7)。
參考
Python 3.0 的新玩意(第一部) on Ping不見路,2008.12
Ubuntu 安裝 Python 3 on 阿舍的隨手記記、隨手寫寫...,2011.12
Python 2 與 3 之字串與檔案 on Thinking more...,2011.07
外文參考
Python 3 Wall of Shame 熱門套件有沒有上 Python 3 的表(婊XD)。
- Python 官網:
Dive Into Python 3 by Mark Pilgrim,2011