W!o 的派生‧十日談之《七》

5141wQKpnDL

cover

Dive Into Python 》 is a free Python book for experienced programmers.

It was originally hosted at DiveIntoPython.org, but the author has pulled down all copies. It is being mirrored here. You can read the book online, or download it in a variety of formats. It is also available in multiple languages.

我們讀書越多,就越發現我們是無知的。── 雪萊

Dive Into Python 3 》 covers Python 3 and its differences from Python 2. Compared to Dive Into Python, it’s about 20% revised and 80% new material. The book is now complete, but feedback is always welcome.

腹有詩書氣自華,讀書萬卷始通神。── 蘇軾

既是活在資訊爆炸的時代,怎麼可能缺乏知識的呢?這事頂不好說,借人家的話來講︰

蒲松齡‧《阿寶

異史氏曰︰『性癡則其志凝,故書癡者文必工,藝癡者技必良。世之落拓而無成者,皆自謂不癡者也。且如粉花蕩產,盧雉頃家,顧癡人事哉!以是知慧黠而過,乃是真癡,彼孫子何癡乎!』

密尔顿‧《论出版自由

因为书籍并不是绝对死的东西。它包藏着一种生命的潜力,和作者一样活跃。不仅如此,它还象一个宝瓶,把创作者活生生的智慧中最纯净的菁华保存起来。我知道它们是非常活跃的,而且繁殖力也是极强的,就象神话中的龙齿①一样。当它们被撒在各处以后,就可能长出武士来。但是,从另一方面来说,如果不特别小心的话,误杀好人和误禁好书就会同样容易。杀人只是杀死了一个理性的动物,破坏了一个上帝的象;而禁止好书则是扼杀了理性本身,破坏了瞳仁中的上帝圣象②。

也許『郭沫若』說的好︰

』是『』的,書是『』的。『』『』讀『』『』,可以把『』讀『』。『』『』讀『』『』,可以把『』讀『』。

 

如何『』 Python ?就從『』本『派生』的『』開始。因『』故及於它『』它『』,以至於『』而已!!

□︰ 難道都不用練習的嗎?

○︰此語未免太癡!《論語》

學而』篇開宗明義講︰『』而時『』之的吧!!

比方說《潜入派生》 Dive into Python 第二章第四節

《 2.4. Everything Is an Object 》講︰

2.4.2. What’s an Object?

Everything in Python is an object, and almost everything has attributes and methods. All functions have a built-in attribute __doc__, which returns the doc string defined in the function’s source code. The sys module is an object which has (among other things) an attribute called path. And so forth.

Still, this begs the question. What is an object? Different programming languages define “object” in different ways. In some, it means that all objects must have attributes and methods; in others, it means that all objects are subclassable. In Python, the definition is looser; some objects have neither attributes nor methods (more on this in Chapter 3), and not all objects are subclassable (more on this in Chapter 5). But everything is an object in the sense that it can be assigned to a variable or passed as an argument to a function (more in this in Chapter 4).

This is so important that I’m going to repeat it in case you missed it the first few times: everything in Python is an object. Strings are objects. Lists are objects. Functions are objects. Even modules are objects.

那麼我們將如何理解『在派生中,一切皆是物件。』這句話呢?要是不深入『派生』的『語法』以及『語意』,只依靠著『語用』根本是不足以『回答』的吧!而且不同的『程式語言』,『口號』不同,『哲學』也不一樣!!Python 號稱『多典範』,『程序』為主的寫作、『物件』中心之編程,『泛函式』概念的淺嚐,……等等,也許可以這麼說︰

『派生』支持的『作法』,讓它『語法』上『方便容易』。

『派生』不支持的『行事』,也可『己選自擇』的『表現』。

因此想要掌握 Python 語言,『深思』、『細慮』以及『多實驗』或許是個好的起步。就像嘗試看看,在『派生』中,什麼是『函式』 function 的呢?

 

 

─── 豈是一句『可呼叫』 callable 了得!! ───