Posted on 2008-10-15 08:27
pts 閱讀(980)
評論(1) 編輯 收藏 所屬分類:
Python
摘自<a target="_blank">啄木鳥社區</a>
(找到的原文是rst格式)
Python 語言研究
== 概述 ==
. 對于一種編程語言來說,語法格式是其最直觀的表現,各種類庫的 API 是其最直接的應用。
. 但在水面之下,語言的基礎設施、模型、原理以及背后的設計思想才是其最本質的部分,也是一種語言真正區別于另一種的所在。
. 此條目關注 Python 本身語言、語法的研究和探討,收集整理相關的文檔和心得(尤其是中文資料)。
. 如無特別注明,均以 CPython 實現為準。
== 系統學習 ==
* 參見[:PyBooks:Python 圖書概覽]
. 對于語言特性的學習來說,特別推薦以下幾本
* 《Python Tutorial》(最新版本2.5) -- 最新,最權威,公開文檔
* 《A Byte of Python》 -- 簡潔明了,淺顯易懂,公開文檔
* 《Learning Python》(第二版) -- 最細致,最深入
* 《Text Process in Python》的附錄A :[:TPiP/AppendixA:python精要]
. “對 python 的超精簡的但絕不失深度的介紹” -- from 譯者 HuangYi
== 語言進化 ==
* [http://docs.python.org/dev/whatsnew/whatsnew25.html What's New in Python 2.5]
* [http://www.aleax.it/Python/py25.pdf Python 2.5 Slides by Alex Martelli]
* [:WeiZhong/WhatsNewOfPython25:WeiZhong 節譯]
* [:PythoNology/New4Py2.5:ZoomQuiet 譯自另一篇文檔]
* [http://docs.python.org/dev/whatsnew/ What's New in Python 2.6]
* [:Python3000:Python 3000 專題] -- 收集了 Python 3000 的規范、展望和最新消息
== 專題剖析 ==
=== 內置類型和操作 ===
* [http://www.voidspace.org.uk/python/articles/python_datatypes.shtml A Very Brief Introduction to Python And its Data-Types]
. “一篇短小精悍的 python tutorial 。對一些容易被忽視的問題講得很清楚!很專業的 tutorial!” -- from HuangYi
* [http://blog.donews.com/limodou/archive/2004/05/11/18038.aspx 集合(sets)模塊] from [http://blog.donews.com/limodou/ limodou 的學習記錄]
. 在 2.4 以后,sets 模塊已經成為內置類型 set
=== 語句和語法 ===
==== 自省 ====
* [http://www.ibm.com/developerworks/cn/linux/l-pyint/index1.html Python 自省指南]、[http://www.ibm.com/developerworks/cn/linux/l-pyint/index2.html (二)] (原網頁上“下一頁”鏈接有誤)
. 發表于 IBM developerWorks 網站,作者 Patrick O'Brien 是 Py``Crust 的作者,此為中文版。
* [:PyBatteriesIncluded:內省的威力]
==== Iterator、Generator 和 yield ====
* [http://www.ibm.com/developerworks/cn/linux/sdk/python/charm-20/index.html 可愛的 Python: 迭代器和簡單生成器——Python 2.2 中的新型構造]
* [http://www.ibm.com/developerworks/cn/linux/sdk/python/charm-25/index.html 可愛的 Python: 用 Python 生成器實現“輕便線程”——微線程的力量]
* [http://www.ibm.com/developerworks/cn/linux/sdk/python/charm-26/index.html 可愛的 Python: 基于生成器的狀態機——用基于生成器的狀態機和協同程序增加效率]
. 以上三篇均為 David Mertz 的 developerWorks Python 專欄文章
* [http://blog.donews.com/limodou/archive/2004/07/10/40913.aspx Iterator 和 Generator的學習心得] by limodou
* [:Py25yieldNote:Py2.5 yield 詳說] -- shhgs 和 limodou 關于 yield 在2.5中加強語法的探討
* [:HuangYi/yield_stacklesspython:用 2.5 中的 yield 模擬 Stackless Python] by HuangYi
. 可與[http://www.ibm.com/developerworks/cn/linux/sdk/python/charm-25/index.html 《用 Python 生成器實現“輕便線程”》]對照,加強的 yield 語法帶來了更強大的力量和更靈活的運用
==== Decorator ====
* [wiki:peps/pep-0318/ PEP 318 : Decorators for Functions and Methods]
* [:WeiZhong/DecoratorsInPython24:Python2.4中的新東西(1):函數和方法的修飾符] by WeiZhong
* [http://blog.donews.com/limodou/archive/2004/12/19/207521.aspx decorator的使用] by limodou
* [http://www.donews.net/limodou/archive/2004/12/20/208356.aspx Decorator 應用:使用decorator的線程同步] by limodou
* [http://blog.donews.com/limodou/archive/2004/12/31/221653.aspx 關于閱讀《Doing abstract methods with decorators》的思考] by limodou
==== with ====
=== 名字空間與對象模型 ===
==== 概述 ====
* Python 官方網站上的 [http://www.python.org/doc/newstyle/ New-style Classes 經典文檔匯集]
* [http://www.effbot.org/zone/python-objects.htm Python Objects]
. Python 對象概念簡析 —— 比你想像中更簡單!
* 兩篇系統講解的精彩文檔
* [http://www.cafepy.com/article/python_types_and_objects Python Types and Objects]
* [http://www.cafepy.com/article/python_attributes_and_methods/ Python Attributes and Methods]
* [:PyNewStyleClass:Python 中的新型類及其實例詳解] -- WeiZhong 節譯自《Python in a Nutshell》(第一版)
* [http://blog.csdn.net/jrgao/archive/2004/03/04/22248.aspx python的對象與名字綁定]、[http://blog.csdn.net/dreamingk/archive/2004/07/26/51658.aspx 對于"python的對象與名字綁定"一文錯誤的糾正!]
* [http://blog.donews.com/limodou/archive/2005/07/09/460187.aspx 關于Python對象及名字綁定] -- limodou 的補充感想
==== Metaclass ====
* [:MetaClassInPython:Python中的元類(metaclass)] -- WeiZhong 節譯自《Python in a Nutshell》(第一版)
* [http://www.ibm.com/developerworks/cn/linux/l-pymeta/index.html Python 中的元類編程]、[http://www.ibm.com/developerworks/cn/linux/l-pymeta2/index.html Python 中的元類編程,第 2 部分]
. 發表于 IBM developerWorks 網站,作者為知名 Python 專欄作家 David Mertz,此為中文版。
* [http://www.python.org/pycon/dc2004/papers/24/metaclasses-pycon.pdf Python Metaclasses: Who? Why? When?] -- 2004年 Py{{{}}}Con 上的一篇講稿
* [http://www.voidspace.org.uk/python/articles/metaclasses.shtml Eliminating self with Metaclasses]
. Python 在成員方法中對 self 的顯式聲明往往會令初學者困惑和不習慣,Michael Foord 在這篇文章中利用 metaclass 和 bytecode 實現了一種不需要顯式聲明 self 參數的類定義方式。
* HuangYi 的心得,發表于[http://codeplayer.blogspot.com 他的 blog]
* [http://codeplayer.blogspot.com/2006/12/metaclass-in-python.html metaclass in python (part 1)]
* [http://codeplayer.blogspot.com/2006/12/metaclass-in-python-part-2.html metaclass in python (part 2)]
==== Descriptor ====
* [http://users.rcn.com/python/download/Descriptor.htm How-To Guide for Descriptors] -- descriptor 機制詳解,by Raymond Hettinger
* [http://codeplayer.blogspot.com/2006/12/python-method-function-descriptor.html 理解 python 的 method 和 function 兼談 descriptor] by HuangYi
==== Magic Methods ====
* [http://blog.donews.com/limodou/archive/2004/10/16/134808.aspx 使用__getattr__要注意的]、[http://blog.donews.com/limodou/archive/2004/10/18/137326.aspx 又一次談“使用__getattr__要注意的”]
. 自定義 __getattr__ 帶來的意想不到的副作用, from [http://blog.donews.com/limodou/ limodou 的學習記錄]
=== 模塊導入機制 ===
* [http://www.ibm.com/developerworks/cn/linux/sdk/python/python-8/index.html 可愛的 Python:動態重新裝入——在長期運行的進程中動態重新裝入模塊]
. David Mertz 的 developerWorks Python 專欄文章
* [http://blog.donews.com/limodou/archive/2005/06/10/422024.aspx __import__與reload要注意的] from [http://blog.donews.com/limodou/ limodou 的學習記錄]
=== 異常機制 ===
=== 其它 ===
* [http://www-128.ibm.com/developerworks/cn/linux/l-pydisp/index.html 可愛的 Python: 多分派——用多元法泛化多態性]
* [http://blog.donews.com/limodou/archive/2004/07/24/49297.aspx 我看“Python中的多分派”] -- limodou的感想
* [http://codeplayer.blogspot.com/2006/09/getcaller.html 意外收獲:get_caller] by HuangYi
* [http://www.donews.net/limodou/archive/2004/12/28/218443.aspx Python 中的 Lazy 計算]、[http://blog.donews.com/limodou/archive/2004/12/30/221020.aspx 再談一談Lazy計算] from [http://blog.donews.com/limodou/ limodou 的學習記錄]
== 參考 ==
* http://www.python.org/doc/newstyle/
* ["ThinkIntoPython"]
* ["PythonZhDoc"]
* ["PythoNology"]
* http://www.voidspace.org.uk/python/index.shtml
* [http://www.ibm.com/developerworks/cn/linux/theme/special/index.html#python IBM developerWorks 的 Python 專欄]
* [http://blog.donews.com/limodou/ limodou 的學習記錄] -- limodou 的 blog
* [http://codeplayer.blogspot.com 白菜] -- HuangYi 的 blog