《CPython Internals》閱讀筆記:p285-p328
《CPython Internals》學習第 15天,p285-p328 總結,總計 44 頁。
一、技術總結
1.shallow comparison
p285, In Objects object.c, the base implementation of the object type is written in pure C code. There are some concrete implementations of basic logic, like shallow comparisons(《CPython Internals》第285頁)。
shallow 和 deep這兩個詞常見于 copy(shallow copy, deep copy) 和 comparison(shallow comparison, deep comparison) 操作中。
但是個人覺得從字面意思不好理解。示例:TBD。
2.dunder method
All these functions can be overridden in a custom object by implementing dunder methods on a Python object(《CPython Internals》第286頁)。
看到 dunder methods, 一下子沒反應過來什么樣的方法叫 dunder methods, dunder 是什么意思?查了下,dunder是 double under的縮寫,其實是為了發音(pronunce)方便, 由 Mark Jackson提出:
An awkward thing about programming in Python: there are lots of double underscores. [snip] My problem with the double underscore is that it's hard to say. How do you pronounce init? "underscore underscore init underscore underscore"? "under under init under under"? Just plain "init" seems to leave out something important. I have a solution: double underscore should be pronounced "dunder". So init is "dunder init dunder", or just "dunder init".
dunder method 也稱為 magic method 或者 special method。
二、英語總結(生詞:2)
無。
關于英語的注解同步更新匯總到 https://github.com/codists/English-In-CS-Books 倉庫。
三、其它
無。
四、參考資料
1. 編程
(1) Anthony Shaw,《CPython Internals》:https://book.douban.com/subject/35405785/
2. 英語
(1) Etymology Dictionary:https://www.etymonline.com
(2) Cambridge Dictionary:https://dictionary.cambridge.org

歡迎搜索及關注:編程人(a_codists)
浙公網安備 33010602011771號