SlideShare una empresa de Scribd logo
1 de 26
Descargar para leer sin conexión
1. Python起步走
• 學習目標
– 選擇 2.x 還是 3.x?
– 初識 Python 資源
– 認識 Python 實作
– 建立 Python 環境
Python 3的誕生
• 2008 年 12 月 3 日,新出爐的 Python 3.0
(也被稱為 Python 3000 或 Py3K)
• 包含了許多人引頸期盼的新功能
• 其他語法與程式庫方面的變更,也破壞了
向後相容性
• 許多基於 Python 2.x 的程式,無法直接在
Python 3.0 的環境中運行
• Python 3.0 演進的指導原則
– 將處理事情的老方法移除,以減少特性的重複
– 做事時應該只有一種(也許也是唯一)明確的
方式」之條目
• 我要學 Python 3,還是 Python 2?
– 在 Python 3.0 剛釋出沒多久的那段日子裏,答
案通常會是「學習 Python 2.x,因為許多程式
庫還不支援!」
– 許多介紹 Python 的入門文件或書藉,也不得
不同時介紹 Python 2 與 3 兩個版本
– 「2to3」也不能發現所有的問題
從Python 3.0到3.5
• 官方的推動
• Python 2 可以試著from __future__
import想使用的模組
• 〈Python2orPython3〉整理了許多相容轉
換的相關資源
– Python 3.0 的一些較不具破壞性的特性,回饋
(backport)到 Python 2.6 之中
– Python 3.1 的特性,回饋到了 Python 2.7 之
中
• 回饋也會反過來從 2.x 至 3.x
– 在 Python 3.3 中又支援了 u‘foo’ 來表示
unicode 字串,b‘foo’來表示 byte 字串
• 相容性同時在 2.x 與 3.x 之間前進著,試著
讓語法有更多交集。
• Python 3.x 本身也不斷地吸納社群經驗
– Python 3.3 中包含了 venv 模組
– Python 3.4 本身就包含了 pip
– Python 3.5 更納入了 Type hints
社群的接納
• 許多基於 Python 2.x 的程式庫或框架,這
段期間一直不斷地往 Python 3.x 遷移
– Django
– Numpy
– SciPy
• 〈PYTHON 3 WALL OF SUPERPOWERS〉
– python3wos.appspot.com
• 新系統要開發時,究竟要基於 Python 2.x
或Python 3.x?
– 建立良好的程式碼慣例
– 社群中還有著 six 這類的套件,可以寫出相容
2.7 和 3.x 的程式碼基礎 six
• Python 2.7 是 Python 2 的最後一個版本
(不會再有 Python 2.8了),且預計僅支
援至 2020 年
• 作業系統也開始進行相對應的處理動作
– Linux 目前多半同時預載了 Python 2.x 與 3.x
• 我要學習 Python 2.x 還是 Python 3.x?
• 作個全面性的調查
– 就像在選擇一門語言,或者是調查某個程式庫
是否可以採用時,必須有著諸多考量,像是瞭
解其更新(Update)的時間、修改記錄
(Changelog)、修正問題(Issue)的速率、
作者身份等。
• 我要學習 Python 2.x 還是 Python 3.x?
• 學習 Python 來說,可以先學 Python 3.x,
因為有了 Python 3.x 的基礎,將來若有必
要面對與學習 Python 2.x,並不會是件難
事
初識社群資源
• Python 之父 Guido van Rossum
– 首位享有 BDFL 封號的開放原始碼軟體創建者
– 對社群仍持續關注,在必要時能針對社群中的
意見與爭議提出想法與做出最後裁決
• Python 軟體基金會
– Python Software Foundation,常簡稱為 PSF
– 推廣、維護與促進 Python 程式語言的發展,
同時也支持協助全球各地各式各樣 Python 程
式設計師與社群的成長
– 非營利組織,持有 Python 程式語言背後的智
慧財產權
• Python改進提案
– Python Enhancement Proposals,常簡稱為
PEPs
– Python 的改進多是由PEP流程主導
– PEP 流程會收集來自社群的意見,為將來打算
加入 Python 的新特性提出文件提案
– 重要的 PEP 會經由社群與 Guido 審閱與評估,
決定是否成為正式的 PEP 文件
• Python 研討會
– 如果想要知道各地的研討會資訊,可
– 以從 PyCon 網站(www.pycon.org )開始
– 〈"PyCon Taiwan" in Taiwan〉可以看到台灣
Python 社群關注的重要研討會訊息
• Python 使用者群組
– PyTUG Wiki(台灣Python 使用者群組Wiki 網站)
– PyTUG Groups(台灣Python 使用者群組論譠)
– PyHUG Meetups(新竹Python 使用者群組)
– Taipei.py Meetups(台北Python 使用者群組)
– Tainan.py Meetups(台南Python 使用者群組)
Python 的實作
• CPython
– Python 官方的參考實作
– 以C 撰寫的實作品
– 提供與 Python 套件(Package)與 C 擴充模
組的最高相容性
• PyPy
– 使用 RPython(Restricted Python)來實現
– 目的在改進 Python 程式的執行效能,同時追
求與 CPython 的最大相容性
• Jython
– 用 Java 實現的 Python
– 能匯入、取用 Java 的相關程式庫,因而得以運
用 Java 領域中的各式資源
• IronPython
– 可與 .NET 平台結合的 Python 開放原始碼實現
下載與安裝 Python 3.5
認識安裝內容
Python 起步走
Python 起步走

Más contenido relacionado

La actualidad más candente

简单Pthon教程
简单Pthon教程简单Pthon教程
简单Pthon教程junjun chen
 
從 REPL 到 IDE
從 REPL 到 IDE從 REPL 到 IDE
從 REPL 到 IDEJustin Lin
 
[系列活動] Python 程式語言起步走
[系列活動] Python 程式語言起步走[系列活動] Python 程式語言起步走
[系列活動] Python 程式語言起步走台灣資料科學年會
 
Python 入门
Python 入门Python 入门
Python 入门kuco945
 
教青少年寫程式
教青少年寫程式教青少年寫程式
教青少年寫程式Renyuan Lyu
 
Learning python in the motion picture industry by will zhou
Learning python in the motion picture industry   by will zhouLearning python in the motion picture industry   by will zhou
Learning python in the motion picture industry by will zhouWill Zhou
 
函数调用关系工具-2011-孙光福
函数调用关系工具-2011-孙光福函数调用关系工具-2011-孙光福
函数调用关系工具-2011-孙光福Wu Liang
 
Python核心编程(中文 第二版)
Python核心编程(中文 第二版)Python核心编程(中文 第二版)
Python核心编程(中文 第二版)yiditushe
 
相關軟體、套件安裝與除錯工具
相關軟體、套件安裝與除錯工具相關軟體、套件安裝與除錯工具
相關軟體、套件安裝與除錯工具數真 蔡
 
Python beginner tutorial
Python beginner tutorialPython beginner tutorial
Python beginner tutorialcri fan
 
12, string
12, string12, string
12, stringted-xu
 
Python topic re
Python topic rePython topic re
Python topic recri fan
 

La actualidad más candente (19)

Python系列3
Python系列3Python系列3
Python系列3
 
Python系列4
Python系列4Python系列4
Python系列4
 
简单Pthon教程
简单Pthon教程简单Pthon教程
简单Pthon教程
 
從 REPL 到 IDE
從 REPL 到 IDE從 REPL 到 IDE
從 REPL 到 IDE
 
Python 01 Introduction
Python 01  IntroductionPython 01  Introduction
Python 01 Introduction
 
Python系列1
Python系列1Python系列1
Python系列1
 
Py ladies 0928
Py ladies 0928Py ladies 0928
Py ladies 0928
 
[系列活動] Python 程式語言起步走
[系列活動] Python 程式語言起步走[系列活動] Python 程式語言起步走
[系列活動] Python 程式語言起步走
 
Python 入门
Python 入门Python 入门
Python 入门
 
fork理解
fork理解fork理解
fork理解
 
教青少年寫程式
教青少年寫程式教青少年寫程式
教青少年寫程式
 
建置Python開發環境
建置Python開發環境建置Python開發環境
建置Python開發環境
 
Learning python in the motion picture industry by will zhou
Learning python in the motion picture industry   by will zhouLearning python in the motion picture industry   by will zhou
Learning python in the motion picture industry by will zhou
 
函数调用关系工具-2011-孙光福
函数调用关系工具-2011-孙光福函数调用关系工具-2011-孙光福
函数调用关系工具-2011-孙光福
 
Python核心编程(中文 第二版)
Python核心编程(中文 第二版)Python核心编程(中文 第二版)
Python核心编程(中文 第二版)
 
相關軟體、套件安裝與除錯工具
相關軟體、套件安裝與除錯工具相關軟體、套件安裝與除錯工具
相關軟體、套件安裝與除錯工具
 
Python beginner tutorial
Python beginner tutorialPython beginner tutorial
Python beginner tutorial
 
12, string
12, string12, string
12, string
 
Python topic re
Python topic rePython topic re
Python topic re
 

Destacado

從模組到類別
從模組到類別從模組到類別
從模組到類別Justin Lin
 
網站系統安全及資料保護設計認知
網站系統安全及資料保護設計認知網站系統安全及資料保護設計認知
網站系統安全及資料保護設計認知Justin Lin
 
OpenSCAD Workshop
OpenSCAD WorkshopOpenSCAD Workshop
OpenSCAD WorkshopJustin Lin
 
Advance OOP concepts in Python
Advance OOP concepts in PythonAdvance OOP concepts in Python
Advance OOP concepts in PythonSujith Kumar
 
Python Tricks That You Can't Live Without
Python Tricks That You Can't Live WithoutPython Tricks That You Can't Live Without
Python Tricks That You Can't Live WithoutAudrey Roy
 
Basics of Object Oriented Programming in Python
Basics of Object Oriented Programming in PythonBasics of Object Oriented Programming in Python
Basics of Object Oriented Programming in PythonSujith Kumar
 
Introduction to Python
Introduction to Python Introduction to Python
Introduction to Python amiable_indian
 
Python的50道陰影
Python的50道陰影Python的50道陰影
Python的50道陰影Tim (文昌)
 
資料永續與交換
資料永續與交換資料永續與交換
資料永續與交換Justin Lin
 
流程語法與函式
流程語法與函式流程語法與函式
流程語法與函式Justin Lin
 
Python 3 Programming Language
Python 3 Programming LanguagePython 3 Programming Language
Python 3 Programming LanguageTahani Al-Manie
 
Python Programming Essentials - M44 - Overview of Web Development
Python Programming Essentials - M44 - Overview of Web DevelopmentPython Programming Essentials - M44 - Overview of Web Development
Python Programming Essentials - M44 - Overview of Web DevelopmentP3 InfoTech Solutions Pvt. Ltd.
 
類別的繼承
類別的繼承類別的繼承
類別的繼承Justin Lin
 
除錯、測試與效能
除錯、測試與效能除錯、測試與效能
除錯、測試與效能Justin Lin
 
並行與平行
並行與平行並行與平行
並行與平行Justin Lin
 

Destacado (20)

例外處理
例外處理例外處理
例外處理
 
資料結構
資料結構資料結構
資料結構
 
從模組到類別
從模組到類別從模組到類別
從模組到類別
 
網站系統安全及資料保護設計認知
網站系統安全及資料保護設計認知網站系統安全及資料保護設計認知
網站系統安全及資料保護設計認知
 
OpenSCAD Workshop
OpenSCAD WorkshopOpenSCAD Workshop
OpenSCAD Workshop
 
Advance OOP concepts in Python
Advance OOP concepts in PythonAdvance OOP concepts in Python
Advance OOP concepts in Python
 
Python Tricks That You Can't Live Without
Python Tricks That You Can't Live WithoutPython Tricks That You Can't Live Without
Python Tricks That You Can't Live Without
 
Python 2 vs. Python 3
Python 2 vs. Python 3Python 2 vs. Python 3
Python 2 vs. Python 3
 
Basics of Object Oriented Programming in Python
Basics of Object Oriented Programming in PythonBasics of Object Oriented Programming in Python
Basics of Object Oriented Programming in Python
 
Introduction to Python
Introduction to Python Introduction to Python
Introduction to Python
 
Python的50道陰影
Python的50道陰影Python的50道陰影
Python的50道陰影
 
Python
PythonPython
Python
 
資料永續與交換
資料永續與交換資料永續與交換
資料永續與交換
 
流程語法與函式
流程語法與函式流程語法與函式
流程語法與函式
 
Python Programming Essentials - M22 - File Operations
Python Programming Essentials - M22 - File OperationsPython Programming Essentials - M22 - File Operations
Python Programming Essentials - M22 - File Operations
 
Python 3 Programming Language
Python 3 Programming LanguagePython 3 Programming Language
Python 3 Programming Language
 
Python Programming Essentials - M44 - Overview of Web Development
Python Programming Essentials - M44 - Overview of Web DevelopmentPython Programming Essentials - M44 - Overview of Web Development
Python Programming Essentials - M44 - Overview of Web Development
 
類別的繼承
類別的繼承類別的繼承
類別的繼承
 
除錯、測試與效能
除錯、測試與效能除錯、測試與效能
除錯、測試與效能
 
並行與平行
並行與平行並行與平行
並行與平行
 

Similar a Python 起步走

Python 进化之路.pptx
Python 进化之路.pptxPython 进化之路.pptx
Python 进化之路.pptxManjusaka1
 
01.python.开发最佳实践
01.python.开发最佳实践01.python.开发最佳实践
01.python.开发最佳实践Na Lee
 
用简单语言构建复杂系统
用简单语言构建复杂系统用简单语言构建复杂系统
用简单语言构建复杂系统Leo Zhou
 
Python First Class
Python First ClassPython First Class
Python First ClassYao Zuo
 
第10章 Python计算生态.pptx
第10章 Python计算生态.pptx第10章 Python计算生态.pptx
第10章 Python计算生态.pptxedvardarcher
 
Python meetup 1
Python meetup 1Python meetup 1
Python meetup 1Vic Yang
 
Jupyter 簡介—互動式的筆記本系統
Jupyter 簡介—互動式的筆記本系統Jupyter 簡介—互動式的筆記本系統
Jupyter 簡介—互動式的筆記本系統Chengtao Lin
 
Ready Programmer One
Ready Programmer OneReady Programmer One
Ready Programmer Oneflywindy
 
Learn python 2 - Real World Case
Learn python 2 - Real World CaseLearn python 2 - Real World Case
Learn python 2 - Real World CaseChia-Hao Tsai
 
代码代写付款后,我可以临时更改我的订单要求吗?
代码代写付款后,我可以临时更改我的订单要求吗?代码代写付款后,我可以临时更改我的订单要求吗?
代码代写付款后,我可以临时更改我的订单要求吗?nani260565
 
Adorable python
Adorable pythonAdorable python
Adorable pythonRhythm Sun
 
FeatHub_GAIDC_2022.pptx
FeatHub_GAIDC_2022.pptxFeatHub_GAIDC_2022.pptx
FeatHub_GAIDC_2022.pptxDong Lin
 
[3]投影片 futurewad樹莓派研習會 141204
[3]投影片 futurewad樹莓派研習會 141204[3]投影片 futurewad樹莓派研習會 141204
[3]投影片 futurewad樹莓派研習會 141204CAVEDU Education
 
Python 于 webgame 的应用
Python 于 webgame 的应用Python 于 webgame 的应用
Python 于 webgame 的应用勇浩 赖
 
Summary conversatio-python-group-dalian
Summary conversatio-python-group-dalianSummary conversatio-python-group-dalian
Summary conversatio-python-group-dalianwangyuanyi
 
Python intermediate tutorial
Python intermediate tutorialPython intermediate tutorial
Python intermediate tutorialcri fan
 
Python topic str_encoding
Python topic str_encodingPython topic str_encoding
Python topic str_encodingcri fan
 
基于Python构建可扩展的自动化运维平台
基于Python构建可扩展的自动化运维平台基于Python构建可扩展的自动化运维平台
基于Python构建可扩展的自动化运维平台liuts
 

Similar a Python 起步走 (20)

Python 进化之路.pptx
Python 进化之路.pptxPython 进化之路.pptx
Python 进化之路.pptx
 
01.python.开发最佳实践
01.python.开发最佳实践01.python.开发最佳实践
01.python.开发最佳实践
 
用简单语言构建复杂系统
用简单语言构建复杂系统用简单语言构建复杂系统
用简单语言构建复杂系统
 
Python First Class
Python First ClassPython First Class
Python First Class
 
第10章 Python计算生态.pptx
第10章 Python计算生态.pptx第10章 Python计算生态.pptx
第10章 Python计算生态.pptx
 
Python meetup 1
Python meetup 1Python meetup 1
Python meetup 1
 
Jupyter 簡介—互動式的筆記本系統
Jupyter 簡介—互動式的筆記本系統Jupyter 簡介—互動式的筆記本系統
Jupyter 簡介—互動式的筆記本系統
 
Ready Programmer One
Ready Programmer OneReady Programmer One
Ready Programmer One
 
Learn python 2 - Real World Case
Learn python 2 - Real World CaseLearn python 2 - Real World Case
Learn python 2 - Real World Case
 
代码代写付款后,我可以临时更改我的订单要求吗?
代码代写付款后,我可以临时更改我的订单要求吗?代码代写付款后,我可以临时更改我的订单要求吗?
代码代写付款后,我可以临时更改我的订单要求吗?
 
Adorable python
Adorable pythonAdorable python
Adorable python
 
FeatHub_GAIDC_2022.pptx
FeatHub_GAIDC_2022.pptxFeatHub_GAIDC_2022.pptx
FeatHub_GAIDC_2022.pptx
 
[3]投影片 futurewad樹莓派研習會 141204
[3]投影片 futurewad樹莓派研習會 141204[3]投影片 futurewad樹莓派研習會 141204
[3]投影片 futurewad樹莓派研習會 141204
 
Python01
Python01Python01
Python01
 
Linux File system
Linux File systemLinux File system
Linux File system
 
Python 于 webgame 的应用
Python 于 webgame 的应用Python 于 webgame 的应用
Python 于 webgame 的应用
 
Summary conversatio-python-group-dalian
Summary conversatio-python-group-dalianSummary conversatio-python-group-dalian
Summary conversatio-python-group-dalian
 
Python intermediate tutorial
Python intermediate tutorialPython intermediate tutorial
Python intermediate tutorial
 
Python topic str_encoding
Python topic str_encodingPython topic str_encoding
Python topic str_encoding
 
基于Python构建可扩展的自动化运维平台
基于Python构建可扩展的自动化运维平台基于Python构建可扩展的自动化运维平台
基于Python构建可扩展的自动化运维平台
 

Más de Justin Lin

Ch14 簡介 Spring Boot
Ch14 簡介 Spring BootCh14 簡介 Spring Boot
Ch14 簡介 Spring BootJustin Lin
 
Ch13 整合 Spring MVC/Security
Ch13 整合 Spring MVC/SecurityCh13 整合 Spring MVC/Security
Ch13 整合 Spring MVC/SecurityJustin Lin
 
Ch12 Spring 起步走
Ch12 Spring 起步走Ch12 Spring 起步走
Ch12 Spring 起步走Justin Lin
 
Ch11 簡介 JavaMail
Ch11 簡介 JavaMailCh11 簡介 JavaMail
Ch11 簡介 JavaMailJustin Lin
 
Ch10 Web 容器安全管理
Ch10 Web 容器安全管理Ch10 Web 容器安全管理
Ch10 Web 容器安全管理Justin Lin
 
Ch09 整合資料庫
Ch09 整合資料庫Ch09 整合資料庫
Ch09 整合資料庫Justin Lin
 
Ch08 自訂標籤
Ch08 自訂標籤Ch08 自訂標籤
Ch08 自訂標籤Justin Lin
 
Ch07 使用 JSTL
Ch07 使用 JSTLCh07 使用 JSTL
Ch07 使用 JSTLJustin Lin
 
Ch06 使用 JSP
Ch06 使用 JSPCh06 使用 JSP
Ch06 使用 JSPJustin Lin
 
Ch05 Servlet 進階 API、過濾器與傾聽器
Ch05 Servlet 進階 API、過濾器與傾聽器Ch05 Servlet 進階 API、過濾器與傾聽器
Ch05 Servlet 進階 API、過濾器與傾聽器Justin Lin
 
Ch04 會話管理
Ch04 會話管理Ch04 會話管理
Ch04 會話管理Justin Lin
 
Ch03 請求與回應
Ch03 請求與回應Ch03 請求與回應
Ch03 請求與回應Justin Lin
 
Ch02 撰寫與設定 Servlet
Ch02 撰寫與設定 ServletCh02 撰寫與設定 Servlet
Ch02 撰寫與設定 ServletJustin Lin
 
CH1. 簡介 Web 應用程式
CH1. 簡介 Web 應用程式CH1. 簡介 Web 應用程式
CH1. 簡介 Web 應用程式Justin Lin
 
14. 進階主題
14. 進階主題14. 進階主題
14. 進階主題Justin Lin
 
13.並行、平行與非同步
13.並行、平行與非同步13.並行、平行與非同步
13.並行、平行與非同步Justin Lin
 
12. 除錯、測試與效能
12. 除錯、測試與效能12. 除錯、測試與效能
12. 除錯、測試與效能Justin Lin
 
11. 常用內建模組
11. 常用內建模組11. 常用內建模組
11. 常用內建模組Justin Lin
 
10. 資料永續與交換
10. 資料永續與交換10. 資料永續與交換
10. 資料永續與交換Justin Lin
 
9. 資料結構
9. 資料結構9. 資料結構
9. 資料結構Justin Lin
 

Más de Justin Lin (20)

Ch14 簡介 Spring Boot
Ch14 簡介 Spring BootCh14 簡介 Spring Boot
Ch14 簡介 Spring Boot
 
Ch13 整合 Spring MVC/Security
Ch13 整合 Spring MVC/SecurityCh13 整合 Spring MVC/Security
Ch13 整合 Spring MVC/Security
 
Ch12 Spring 起步走
Ch12 Spring 起步走Ch12 Spring 起步走
Ch12 Spring 起步走
 
Ch11 簡介 JavaMail
Ch11 簡介 JavaMailCh11 簡介 JavaMail
Ch11 簡介 JavaMail
 
Ch10 Web 容器安全管理
Ch10 Web 容器安全管理Ch10 Web 容器安全管理
Ch10 Web 容器安全管理
 
Ch09 整合資料庫
Ch09 整合資料庫Ch09 整合資料庫
Ch09 整合資料庫
 
Ch08 自訂標籤
Ch08 自訂標籤Ch08 自訂標籤
Ch08 自訂標籤
 
Ch07 使用 JSTL
Ch07 使用 JSTLCh07 使用 JSTL
Ch07 使用 JSTL
 
Ch06 使用 JSP
Ch06 使用 JSPCh06 使用 JSP
Ch06 使用 JSP
 
Ch05 Servlet 進階 API、過濾器與傾聽器
Ch05 Servlet 進階 API、過濾器與傾聽器Ch05 Servlet 進階 API、過濾器與傾聽器
Ch05 Servlet 進階 API、過濾器與傾聽器
 
Ch04 會話管理
Ch04 會話管理Ch04 會話管理
Ch04 會話管理
 
Ch03 請求與回應
Ch03 請求與回應Ch03 請求與回應
Ch03 請求與回應
 
Ch02 撰寫與設定 Servlet
Ch02 撰寫與設定 ServletCh02 撰寫與設定 Servlet
Ch02 撰寫與設定 Servlet
 
CH1. 簡介 Web 應用程式
CH1. 簡介 Web 應用程式CH1. 簡介 Web 應用程式
CH1. 簡介 Web 應用程式
 
14. 進階主題
14. 進階主題14. 進階主題
14. 進階主題
 
13.並行、平行與非同步
13.並行、平行與非同步13.並行、平行與非同步
13.並行、平行與非同步
 
12. 除錯、測試與效能
12. 除錯、測試與效能12. 除錯、測試與效能
12. 除錯、測試與效能
 
11. 常用內建模組
11. 常用內建模組11. 常用內建模組
11. 常用內建模組
 
10. 資料永續與交換
10. 資料永續與交換10. 資料永續與交換
10. 資料永續與交換
 
9. 資料結構
9. 資料結構9. 資料結構
9. 資料結構
 

Python 起步走

  • 1.
  • 2. 1. Python起步走 • 學習目標 – 選擇 2.x 還是 3.x? – 初識 Python 資源 – 認識 Python 實作 – 建立 Python 環境
  • 3. Python 3的誕生 • 2008 年 12 月 3 日,新出爐的 Python 3.0 (也被稱為 Python 3000 或 Py3K) • 包含了許多人引頸期盼的新功能 • 其他語法與程式庫方面的變更,也破壞了 向後相容性 • 許多基於 Python 2.x 的程式,無法直接在 Python 3.0 的環境中運行
  • 4. • Python 3.0 演進的指導原則 – 將處理事情的老方法移除,以減少特性的重複 – 做事時應該只有一種(也許也是唯一)明確的 方式」之條目
  • 5. • 我要學 Python 3,還是 Python 2? – 在 Python 3.0 剛釋出沒多久的那段日子裏,答 案通常會是「學習 Python 2.x,因為許多程式 庫還不支援!」 – 許多介紹 Python 的入門文件或書藉,也不得 不同時介紹 Python 2 與 3 兩個版本 – 「2to3」也不能發現所有的問題
  • 7. • Python 2 可以試著from __future__ import想使用的模組 • 〈Python2orPython3〉整理了許多相容轉 換的相關資源 – Python 3.0 的一些較不具破壞性的特性,回饋 (backport)到 Python 2.6 之中 – Python 3.1 的特性,回饋到了 Python 2.7 之 中
  • 8. • 回饋也會反過來從 2.x 至 3.x – 在 Python 3.3 中又支援了 u‘foo’ 來表示 unicode 字串,b‘foo’來表示 byte 字串 • 相容性同時在 2.x 與 3.x 之間前進著,試著 讓語法有更多交集。 • Python 3.x 本身也不斷地吸納社群經驗 – Python 3.3 中包含了 venv 模組 – Python 3.4 本身就包含了 pip – Python 3.5 更納入了 Type hints
  • 9. 社群的接納 • 許多基於 Python 2.x 的程式庫或框架,這 段期間一直不斷地往 Python 3.x 遷移 – Django – Numpy – SciPy • 〈PYTHON 3 WALL OF SUPERPOWERS〉 – python3wos.appspot.com
  • 10. • 新系統要開發時,究竟要基於 Python 2.x 或Python 3.x? – 建立良好的程式碼慣例 – 社群中還有著 six 這類的套件,可以寫出相容 2.7 和 3.x 的程式碼基礎 six
  • 11. • Python 2.7 是 Python 2 的最後一個版本 (不會再有 Python 2.8了),且預計僅支 援至 2020 年 • 作業系統也開始進行相對應的處理動作 – Linux 目前多半同時預載了 Python 2.x 與 3.x
  • 12. • 我要學習 Python 2.x 還是 Python 3.x? • 作個全面性的調查 – 就像在選擇一門語言,或者是調查某個程式庫 是否可以採用時,必須有著諸多考量,像是瞭 解其更新(Update)的時間、修改記錄 (Changelog)、修正問題(Issue)的速率、 作者身份等。
  • 13. • 我要學習 Python 2.x 還是 Python 3.x? • 學習 Python 來說,可以先學 Python 3.x, 因為有了 Python 3.x 的基礎,將來若有必 要面對與學習 Python 2.x,並不會是件難 事
  • 14. 初識社群資源 • Python 之父 Guido van Rossum – 首位享有 BDFL 封號的開放原始碼軟體創建者 – 對社群仍持續關注,在必要時能針對社群中的 意見與爭議提出想法與做出最後裁決 • Python 軟體基金會 – Python Software Foundation,常簡稱為 PSF – 推廣、維護與促進 Python 程式語言的發展, 同時也支持協助全球各地各式各樣 Python 程 式設計師與社群的成長 – 非營利組織,持有 Python 程式語言背後的智 慧財產權
  • 15. • Python改進提案 – Python Enhancement Proposals,常簡稱為 PEPs – Python 的改進多是由PEP流程主導 – PEP 流程會收集來自社群的意見,為將來打算 加入 Python 的新特性提出文件提案 – 重要的 PEP 會經由社群與 Guido 審閱與評估, 決定是否成為正式的 PEP 文件
  • 16.
  • 17. • Python 研討會 – 如果想要知道各地的研討會資訊,可 – 以從 PyCon 網站(www.pycon.org )開始 – 〈"PyCon Taiwan" in Taiwan〉可以看到台灣 Python 社群關注的重要研討會訊息 • Python 使用者群組 – PyTUG Wiki(台灣Python 使用者群組Wiki 網站) – PyTUG Groups(台灣Python 使用者群組論譠) – PyHUG Meetups(新竹Python 使用者群組) – Taipei.py Meetups(台北Python 使用者群組) – Tainan.py Meetups(台南Python 使用者群組)
  • 18. Python 的實作 • CPython – Python 官方的參考實作 – 以C 撰寫的實作品 – 提供與 Python 套件(Package)與 C 擴充模 組的最高相容性 • PyPy – 使用 RPython(Restricted Python)來實現 – 目的在改進 Python 程式的執行效能,同時追 求與 CPython 的最大相容性
  • 19. • Jython – 用 Java 實現的 Python – 能匯入、取用 Java 的相關程式庫,因而得以運 用 Java 領域中的各式資源 • IronPython – 可與 .NET 平台結合的 Python 開放原始碼實現
  • 21.
  • 22.
  • 23.