第 341 期·中文精讀

吉多·範羅蘇姆:Python 與程式設計的未來

Guido van Rossum: Python and the Future of Programming

Python 之父回顧這門語言的設計初衷,並討論程式語言與開發者工具的未來走向。

官方音訊00:00 / --:--
中文精讀由 AI 基於原始訪談改寫,非官方翻譯,可能存在偏差或錯誤;表述以原音訊與官方文稿為準。說明

Python 3.11 釋出前夕,CPython 團隊給出的承諾是新版本比上一版快 10% 到 60%。一門三十多年前動筆的語言,靠改自己的底層實現拿到這個量級的提速,這份成績單放在任何工程領域都算漂亮。

Lex Fridman 問吉多·範羅蘇姆(Guido van Rossum):這是怎麼做到的。

他沒接這個問題,先糾正了問題裡的一個詞。

"CPython 是最後一個還站著的 Python 實現,也是歷史上第一個,我三十多年前親手寫的那個。"(吉多·範羅蘇姆)

"最後一個還站著的",這句話說得很輕。一門程式語言通常可以有多個實現,Jython 跑在 Java 虛擬機器上,IronPython 跑在 .NET 上,PyPy 用 Python 自己寫自己。這些名字前面都得掛個字首,因為不加字首就不知道你在說誰。只有 CPython 不需要,它就是 Python 本身。

名字裡的 C 是它用 C 語言寫成。一門語言的預設實現,是用另一門語言寫的程式。這件事在外行眼裡很反常,在程式設計師眼裡是常識,而這期節目的聽眾裡,這兩種人都有。

一條船上坐著兩個人,其中一個只會釣魚

Lex 把聽眾劈成了兩類。一類是在船上釣魚、從沒聽說過程式設計的人,另一類是寫遍 C、C++、Python、Rust、Java,能把程式語言發展史倒背如流的矽谷頂級工程師。一條船,兩個人,中間隔著整個電腦科學。

吉多選了先讓釣魚那位滿意。

"在海上,他顯然是更有用的那個人。你得讓他高興。"(吉多·範羅蘇姆)

怎麼跟他講?他手裡一定有個手機,所以他對手機裡發生的事情大概抱有懷疑。但他至少聽說過手機裡有一塊小小的計算機,而程式語言就是告訴這塊計算機該幹什麼的程式碼。再往下就別講了:零和一,彙編,暫存器。講這些等於在討論人類語言的時候去研究聲道、舌位和氣流。語言學討論"我愛你"這三個字的意思,不討論你的舌尖抵在上齒背還是下齒背。

Lex 在這裡插了一段自己的觀察。他說中文母語者講英語時常常分不清 L 和 R,他有個從沒找語言學家驗證過的猜想:漢語裡這兩個音本來就沒有對立,而不同地區的人在發那個中間音時,有的聽起來像 L,有的聽起來像 R。吉多順著往下接:斯拉夫語系裡有個 j 音,英語母語者發起來很彆扭。兩個人聊了幾句發音,然後一起把這個話題放下了。

放下得對。再往下就是舌頭怎麼擺了,而舌頭怎麼擺,和程式語言是什麼,中間隔著好幾層抽象。

程式語言是一份菜譜,但要餵給兩個讀者

吉多給出的定義是:程式語言就是一份菜譜,一行行告訴你該怎麼做出某樣東西。

買一條麵包,切片,取兩片,一片抹芥末,一片抹果醬,然後放肉,再放乳酪。你要把這件事說得足夠清楚,清楚到沒有任何一種理解方式會出錯。

Lex 說他見過科學老師玩這個遊戲:讓學生寫下做三明治的步驟,老師嚴格照著做,做到學生抓狂為止。學生的意思是"拿兩片面包",老師就真的把整袋麵包都拿過來。

這個遊戲暴露的正是自然語言和程式語言的根本差別。在人類口語裡,歧義是特性,不是缺陷。它是人與人之間那場舞蹈的一部分,你說一半,我猜一半,猜錯了笑一下,再補一句。律師喜歡歧義,因為歧義就是訴訟費。日常對話裡歧義也會帶來麻煩,但人們繞著走,靠上下文把它填平。

對著一個你愛的人說"我愛你",對方不會試著編譯這句話然後報錯:請定義"love"。

"不會。不過我猜我太太和我兒子聽到這三個字,理解會非常不一樣。"(吉多·範羅蘇姆)

同樣三個詞,同一個句子,兩個聽眾,兩種含義。靠的還是上下文。換成律師,他會追問你二十個問題。

程式語言乾的事,就是把這個上下文抽掉,把一份菜譜寫成不管誰來讀都只能讀出一種意思的東西。

《Python 之禪》裡那句"可讀性很重要"是說給誰聽的

Lex 提到那份被無數 Python 開發者當口訣背的東西,《Python 之禪》。裡面有一句:可讀性很重要(Readability counts)。

這句話初看很怪。程式碼是給機器看的,機器不在乎你縮排幾個空格,你在中間插一行髒話它照樣跑。可讀性是給誰的?

吉多的回答把整件事翻了個面。軟體開發從四十年代末開始,就一直是件社交活動。那個坐在實驗室裡獨自寫出天才程式碼的瘋狂科學家,其實並不存在。就算真的存在,他打字的速度也快不到哪去,等到他寫完最後一行,前面那幾十行寫了什麼,他自己也記不清了。

所以寫程式碼的時候,你同時在跟兩個物件說話。

一本菜譜只有一個讀者。作者寫一次,印十萬份,十萬人照著做櫻桃派。作者的全部目標是讓廚房裡那位業餘廚師看懂。軟體這個行當完全不同。軟體太複雜,複雜到你不可能一次寫對,所以必然有除錯,必然有修改,必然有別人接手,也必然有一年之後的你自己回來看這段程式碼。

兩個讀者,兩套要求,還經常打架。這就是為什麼"程式碼風格"這種東西在別的行業聽起來像個笑話,在軟體行業卻值得寫進語言的核心文件。

除錯是三個完全不同的東西,被同一個詞裝在一起

Lex 讓吉多給除錯下個定義。那個回答被切成了三層。

最淺一層是蠢錯誤。少打一個字母,括號沒配對,路徑寫錯。

中間一層是邏輯錯誤。程式完全按你寫的跑了,跑出來的東西是錯的,因為你想錯了。

最深一層是這玩意壓根沒用。程式碼沒錯,邏輯沒錯,跑得又穩又快,只是它解決的問題不該被解決,或者解決的方式讓產品變得沒法用。

還有第四層,吉多專門拎出來說:程式 99% 的時間表現完美,然後在某個邊緣情況上突然發瘋。這是今天幾乎所有軟體的真實狀態。好軟體是這樣,差軟體那個 99% 會掉到 90% 甚至更低。

這句話往下推,得出的結論不太舒服。你今天用的每一個軟體,包括那些支撐銀行、醫院和電網的系統,都有若干條路徑是你從來沒走過、也永遠不會被走到的。軟體工程的成熟,相當程度上是學會了在這些路徑上放護欄,而不是假裝它們不存在。

四個空格是怎麼來的

看 Python 程式碼的第一眼,看到的往往是形狀。左邊那道階梯,一層往裡縮一點,像一份排版講究的商務文件。

吉多的解釋很樸素。任何文字的可讀性都靠空間,把一份菜譜的所有專案符號刪掉,句子揉成一整塊,你在廚房裡連"哪些是原料、哪些是步驟、這一步到哪結束"都分不出來。縮排就是給程式碼造出這種可見的分組:一段文字裡套一段更小的文字,再套一段更小的。

問題在於縮排多少。縮排太深,三層之後螢幕上就沒地方放字了。縮排太淺,一眼看不出這是第一層還是第二層。

答案是四。理由是古代排版慣例,加上八十年代那批顯示器的典型寬度,兩個約束一夾,四個空格落在中間。這是個妥協,談不上定理。

Google 的 Python 程式碼風格指南用的是兩個空格,據說 Google 的 C++ 程式碼也是。你不習慣的話,讀起來會有點吃力,因為這種語言裡,高層結構完全由縮排決定,縮排淺了,骨架就模糊了。經典 Unix 那邊更誇張,一個 tab 八格,吉多覺得那看著彆扭,三層之後就貼到螢幕右邊了。

Python 的特殊之處在於,縮排在這裡屬於語法的一部分,風格建議這個說法太輕了。別的語言裡,C、Rust、C++、Java,你把程式碼寫成一整行,編譯器照樣給你編出來,只是同事會想打你。所以現實裡 IDE 會自動幫你縮排,縮錯了還會用紅波浪線吼你。人類用工具把一條軟規範硬成了事實標準,Python 只是把這條已經存在的規矩寫進了語言定義。

花括號本來有可能出現在 Python 裡

Lex 問了個歷史問題:有沒有那麼一個平行宇宙,Python 是用花括號分塊的?

"絕對有。"

吉多說,很長一段時間裡他都確信縮排更好。就算把上下文全部抽掉,單看這個設計,他還是認為縮排更好,因為它減少了視覺噪音。

可惜上下文幾乎就是一切。而程式設計這件事的上下文是:大多數程式設計師都熟悉好幾門語言,哪怕只精通一兩門。除了 Python,可能再加上 Fortran,其他所有主流語言,Java、Rust、C++、JavaScript、TypeScript、Perl,全用花括號標記程式碼塊。Python 是那個異類。

異類是有代價的。一個從 Java 轉過來的人,第一天寫 Python 會覺得少了點什麼,像走路時突然發現自己一直在無意識地甩手。

那為什麼不改?

"Python 裡沒有這個可能性。花括號在 Python 裡已經用來幹別的了,主要是字典。真要想換,會惹出一堆麻煩。"(吉多·範羅蘇姆)

他還補了一句更根本的:你不能重新定義 C 讓它是用縮排的,哪怕你打心底認為縮排更好。一門語言裡,這種級別的東西改不動。比這細小得多的細節,想達成一致都已經夠難了。Python 歷史上真為 tab 和空格打過一場大仗,為四個空格還是兩個還是八個吵過,最後的產物是一份推薦標準,外加一堆給不聽話的人準備的選項。

時間旅行回去,他還是會選縮排

Lex 不放過他,把假設推到底:如果能穿回三十多年前,相容性完全不成問題,Python 從頭再來一遍,你還會選縮排嗎?

會。理由有三條。

第一,它省下一對括號。而這世界上配對的東西永遠不夠用,省下來的括號可以拿去幹別的(在 Python 裡,它們後來確實去幹別的了)。

第二,對完全沒學過程式設計的人更友好。一門十三週的入門課,要把演算法、資料結構、語法、變數、迴圈、函式、遞迴、類、表示式、運算子全塞進去。能少講一個概念,就少一個讓人分心的東西。分號是教學裡最經典的麻煩:編譯器每次都抱怨我分號放錯了地方,或者我又忘了寫分號。Python 沒有分號,你忘不了它,也不會把它放到不該放的位置,因為你從一開始就沒學過它。

第三,也是吉多自己補的反面:強制嚴格,本身就是在教東西。它告訴新手,程式設計是一件在意細節的事,你不能像寫英語作文那樣隨便寫。當然,新手要操心的細節還有很多,這條資訊總能傳達到。

美元符號是一塊記憶體不夠用的化石

Lex 換了個靶子:PHP 裡變數前面那個美元符號。他說這玩意在他的理解裡完全講不通,而且打字累,還特別容易錯。

吉多給了一段考古式的回答,講的是 Unix shell 的來歷。

最早的 shell 根本沒有"給指令碼傳引數"這個概念。一個指令碼就是幾行文字,每行是一條命令,一個非常原始的命令處理器讀它,把行首那個詞當作程式名,剩下的一整行當作文字丟給程式自己去解析成引數。

後來人們想要變數了,尤其是想要引數。麻煩來了。你寫下 program x y,這在原來的語義裡已經有確定含義:x 是一個檔名。可你想說的是"x 是一個變數,它的值才是檔名"。這兩件事必須能區分開。

而在五六十年代,寫這個指令碼直譯器的程式本身是個極小的程式,得塞進很小的一塊記憶體。最省事的做法是:逐字元掃描,看到某個特殊符號就跳到另一段程式碼,把後面一直到空格的東西讀出來當變數名。選哪個符號?美元符號便宜、顯眼、不容易和正常文字撞車。

它同時也是給人類讀者看的。二十行之後你看到 xyz 前面掛著一個美元符號,立刻知道 xyz 是指令碼的引數之一,硬碟上某個檔名這個身份被排除掉了。

PHP、Perl 都繼承了這條血脈。IBM 更早的作業控制語言裡也有類似的東西。這些設計活到了今天,活在支撐整個網際網路後端的程式碼裡。Wikipedia 裡就有一大堆 PHP。

"這就像生物系統。DNA 的內部機制已經穩定了幾億年,裡面全是各種古怪的遺留物。如果你從零設計一個能自我複製的分子系統,絕不會那麼幹。"(吉多·範羅蘇姆)

Lex 順著這個比喻往下說:生物系統有很多奇怪的冗餘,會以奇怪的方式出錯,但在有機體這個層面上依然有韌性。程式碼沒有這種韌性。

吉多不同意。他說你會驚訝於現代程式碼有多強的韌性。哪怕是測試得很充分、實際執行良好的程式碼,裡面也有很多地方是壞的,只是錯誤被一層層機制吸收掉了,包括最後那一層:使用者。使用者被告知重啟電腦,重啟一下,問題就消失了。溫和一點的版本是重新整理頁面,所有人遇到怪事都會下意識刷兩三次,然後才承認這裡真有問題。

Lex 說這個習慣得改,因為刷第二次通常只是把燈又關上了。吉多說,那就刷三次,這才是正確的教訓。

一千行程式碼裡到底有幾個 bug

Lex 丟擲一個想法:如果把執行核武器的程式碼、執行 Twitter、Facebook、Dropbox、Google、Windows 的程式碼,按每千行的 bug 數排成一張表,人們會不會被嚇到。

吉多說這取決於你讀沒讀過這個領域的研究。他記得上世紀八九十年代有過一批研究,覆蓋了各種軟體、各種語言、各種公司、各種開發風格,結論相當穩定:在成熟的、被公認為質量很好的軟體裡,大約是每千行一個 bug。這已經是行業天花板。

Lex 隨即擺出一份資料,來自一家做程式設計分析的公司,視角是開發者端:平均每個開發者每一千行程式碼寫出 70 個 bug,其中 15 個會流到客戶手裡;修一個 bug 花的時間是寫一行程式碼的 30 倍;開發者 75% 的時間花在除錯上;美國一年在找 bug 和修 bug 上燒掉 1130 億美元。

吉多的第一反應是承認自己錯了一個數量級。

緊接著他做了那個關鍵的區分。每千行一個 bug,說的是經過長期測試、已經穩定下來的成熟軟體。每千行 70 個,說的是你剛開始敲鍵盤的時候。這兩個數字根本不測量同一件事。拿它們放在一張圖裡比較,就像拿新生兒的哭鬧次數和成年人的說話次數做對比,然後得出人類越活越沉默的結論。

他也順手把這頁資料看穿了:這是一家賣工具的公司做的內容。頁面底部必然掛著一個"聯絡我們"按鈕,潛臺詞是,你只要掏出比一千一百三十億少一點的錢,我們就幫你把這個坑填上。

Lex 提到 Stack Overflow 上有一份同主題的報告,他想開啟對照一下,頁面顯示"網站維護中"。

"這挺諷刺的。"(吉多·範羅蘇姆)

一個支撐了全世界最大問答社群的技術,在你想引用它的資料時告訴你它掛了。軟體這東西的可靠性,大概就是這麼回事。

你不可能在一年前就寫好今天的釋出計劃

吉多接著解釋那個 70 和 1 之間的落差從哪來。軟體開發是極度迭代的。沒有人真的會做一份"一年後釋出什麼"的完整計劃,然後把細節全部敲定。因為那些細節本身拼起來就是一份程式,而只要它是一份程式,你的計劃裡就也會有 bug,也會有想錯的地方。

所以你實際乾的事是這樣的:敲一堆程式碼,跑一下,看看它是不是你想的那個樣子,不對就改,改完再跑。幾十輪之後,剩下的那些錯誤,才輪得到"每千行一個"這個數字去描述。

Lex 在這裡承認,那個 70 出現的時候他也嚇了一跳。吉多的反應更平靜:這個數字說明的是一件事情,程式碼在誕生階段極其髒,髒到沒法看,而工程的全部工作就是把這份髒慢慢洗乾淨。

他打字只用兩根手指,而且不打算改

話題拐到了打字上。吉多說自己是個很糟的打字員,十個手指都在用,但用得很差。他從沒上過打字課,也從沒專門去糾正這件事。第一次認真學 QWERTY 鍵盤的佈局,是大學裡第一門程式設計課,那時候用的是打孔卡。他就用兩根手指,一個鍵一個鍵地把程式碼戳出來。

Lex 說他有個觀察方法:讓任何一個程式設計師現場演示幾行程式碼,你就盯著他按退格鍵的次數。有人會為了改行首的一個錯字,往回退二十、三十、四十個字元,然後重新敲。熟練一點的會用方向鍵,或者動滑鼠,但滑鼠通常比方向鍵慢。很多人敲一個二十個字元長的單詞,敲到一半發現開頭錯了,就把整個詞退掉重來,有時候要重來三四次才對。

吉多在這裡做了一個區分,這個區分挺重要。打錯一個字然後立刻改掉,嚴格說不算 bug。但你確實為此浪費了時間,而且偶爾會有一個錯字漏網。等你又往下敲了十行,你不知道那十行裡哪一處有問題,只知道某處有問題。

這跟忘記初始化一個變數屬於兩個層面的問題。前者跑一遍就暴露了。後者在 Python 裡也跑一遍就暴露了,現代編譯器大多也能提前抓出來。真正麻煩的是第三種:變數你初始化了,名字也叫對了,但初始化的是另一個東西,或者你本意用的那個變數跟它重名了。這種東西編譯器抓不到,測試也不一定覆蓋得到,它會在某個深夜的線上環境裡冒出來。

把退格鍵挪到拇指下面,是一個價值三十年的決定

Lex 順勢講了自己為什麼用 Kinesis 鍵盤:那種鍵盤把退格鍵放在拇指正下方。普通鍵盤的退格鍵在右手小指夠得著的地方,每按一次你的整隻手都要往外撐一下。很多人一輩子都在承受這個設計帶來的疼痛,只是沒意識到。

吉多問他,如果你在別人那兒,手邊只有標準鍵盤怎麼辦。

Lex 的回答很實在:你可以一輩子隨身帶著鍵盤。他在飛機上要寫程式碼或者大量打字的時候,會把筆記本攤開,再從包裡掏出一把 Kinesis 擺在旁邊。

"我已經接受了自己是個怪人這件事。"(吉多·範羅蘇姆)

這句話往下接的是一段更普遍的經驗:很多人都有自己的一套舒適區配置,某些特定的設定能把生產力拉滿。有人看電影要蓋一條特定的毯子,他要的是那把鍵盤。它帶他進入一個能專注的狀態。

然後他補了一句:他大部分時候都在努力用最先進的 IDE,但真正讓他坐得住的,還是 Emacs。

這才是這期節目裡最有共鳴的一段,因為它咬住了一個所有技術人都要反覆面對的問題:該多緊地抱著順手的工具,又該花多少精力去學新的。

社群一年一換的興奮,多數是噪音

Lex 說,社群給你的訊號是嘈雜的。每年都有一批人為了新工具興奮,而你必須做一個判斷:這些東西是在定義新一代的工作方式,還是會改變程式設計這件事的形態,或者只是一陣風,吹完就散。

前端尤其明顯。JavaScript 框架、構建工具、狀態管理方案,一波接一波地來,一波接一波地走。

他舉了自己的例子。Flash 裡的 ActionScript,他認真學過,學怎麼在裡面寫程式,學怎麼在裡面做圖形動畫。Java applet 也是,他當年寫了相當多的 applet,真心覺得這可能是 Web 的未來。

結果不是。

吉多的回應值得逐句讀。他沒有安慰說"你那些時間沒白費",也沒有附和說"那都是垃圾"。他說的是:這類技術最終都會死掉,但它們最早引入或者最早讓大眾接觸到的那批概念,會被留下來。

Java applet 早就沒了,可"頁面裡包含一小段程式碼,直接響應你的動作"這個念頭,按下按鈕、點開連結、滑鼠懸停,一點沒退場。Flash 當年做那些動畫做得極其痛苦,後來被 JavaScript 的同類方案取代,那確實是更好的做法,但動畫本身還在,只是換了個載體。

"技術演化經常是這樣的:那個最終被扔掉的階段,恰恰是讓你能起步的東西。沒有螺旋槳飛機,就不會有噴氣式飛機。"(吉多·範羅蘇姆)

Lex 在這裡插了一句反駁,而且插得對。從功能上看是這樣,從使用者角度看也是這樣,可從寫程式碼的那個人角度看呢?那些泡在 ActionScript 裡的時間,那些熬在 Java applet 除錯上的夜晚,怎麼算?

他沒能把這個問題問完。文字稿到這裡斷了。

什麼能活三十年,什麼活不過五年

不過這條線其實已經被前面的內容回答了,只是答案散在各處,得自己拼。

看吉多怎麼談 Python 的縮排。他說這件事在 Python 裡已經沒有重新討論的餘地,因為花括號已經在語言裡幹了別的活,動這一個決定會連帶扯出一堆東西。他還說,哪怕你認定縮排更好,你也不能回頭去改 C。一門語言活到一定年頭,它最重要的屬性就從最優變成了穩定。穩定意味著已經寫下的幾億行程式碼明天還能跑,意味著所有人腦子裡那套肌肉記憶還成立。

再看那筆每千行一個 bug 的賬。這個數字之所以能壓到一,靠的是時間。是無數次上線、無數次線上事故、無數次把邊界條件一條條補上。一個專案真正的資產,往往藏在它踩過的、並且被修掉的那些坑裡,漂亮的設計圖紙反倒排在後面。

Flash 死在第五年,Python 活到第三十年,兩者的差別在語法優雅程度之外。關鍵變數是它有沒有長出一整套讓幾百萬人協作的基礎設施:包的生態、標準庫、風格共識、向上相容的承諾。語法可以被抄走,這套東西抄不走。

所以回頭看那些兩年就沒人提的框架,判斷標準其實很樸素:它只是把某件事做得更方便,還是引入了一個會一直留下來的概念?前者是工具,後者是思想。工具會被下一個工具換掉,思想會滲進下一代工具裡,換個名字重新出現。

吉多在訪談裡反覆回到同一個詞:上下文。縮排好不好要看上下文,因為大家都在用花括號。美元符號難用還得留著,因為上下文是五十年前那臺記憶體不夠的機器。一個技術決策是對是錯,很少能在它被做出來的那一刻判斷,得等十年,看它長出什麼。

寫程式碼的人從這條線裡能落下一個有點反直覺的結論。花在某個具體工具上的時間,可能真的會歸零;花在理解它為什麼這麼設計上的時間,基本不會白費。ActionScript 的三個晚上,如果只學了語法,那就是三個晚上;如果順手想明白了為什麼在瀏覽器裡跑動畫要這麼費勁,那筆賬十年後還在給你分紅。

Emacs 也是一樣。它四十多年沒死,鍵位設定合理這個理由站不住腳,恰恰相反,那些鍵位是當年那臺機器的鍵盤佈局留下的化石。它活著是因為它允許使用者把編輯器改造成自己想要的東西,這個念頭活得比它自己久,今天所有現代編輯器都在繼承這條思路。

三十多年前,吉多在一個聖誕節前後開始寫一個直譯器,當時的動機只是想做點事情打發時間。他沒打算設計一門能拿獎的語言,他想設計一個自己願意天天讀的語言,然後堅持了三十年不改主意。這個決定後來變成了幾百萬人每天上班要用的東西。

這件事裡可複製的部分不多,但有一點:他選的那條路,縮排代替花括號,可讀性大於簡短,從頭到尾沒變過。中間被質疑過,被打過仗,被 Google 的風格指南用兩個空格頂回來過,他都認了,但主幹沒動。

一份菜譜要餵給兩個讀者,一個是機器,一個是人。三十年來所有成功的語言都在回答同一個問題:當兩者打架的時候,你站哪邊。吉多站了人這邊,代價是 Python 在效能上一直被人嘲笑。3.11 那個 10% 到 60% 的提升,是他們在不改語言設計的前提下,回頭去改底層實現拿到的。

不推翻自己,只是把地基挖深一點。長跑選手和短跑選手最大的區別,大概就在這裡。

  • 看到"每千行 70 個 bug"這類數字,先問它測的是哪個階段。開發中的程式碼和執行了五年的程式碼,差著一個數量級,混在一起比會得出完全錯誤的結論。
  • 隔一段時間去讀自己一年前寫的程式碼。如果讀得毫不費力,說明對方水平和你一樣且思路一致;如果讀得很痛苦,那些痛苦的地方就是你該改的寫法。
  • 評估一門新技術,別隻看它讓你寫起來多爽,看它引入了哪個概念。概念會留下,語法會被下一個人推翻。
  • 縮排、分號、命名風格這類爭論,交給自動格式化工具,別在會議上花時間。人類的判斷力應該花在演算法選擇和邊界條件上。
  • 把"一次寫對"這個念頭從流程裡刪掉。既然成熟程式碼也有千分之一的錯誤率,那就在架構上預留返工的空間,別指望這次不出錯。
  • 退格鍵的位置值得認真對待。如果你每天要按幾百次,把它挪到拇指下面,這個改動的投入產出比比大多數效率工具都高。
  • 不要因為一個工具"過時了"就否定自己學它的那段時間。檢查一下你從裡面帶走了哪個概念,那個才是真正的收穫。
  • 選定一套自己坐得住的工具,別每年重灌一遍環境。舒適區省下的注意力,可以全部投給真正難的問題。
文稿由本站用語音識別模型(基於官方釋出音訊)機器轉寫,可能有識別錯誤,人名與數字請以音訊為準。
Lex Fridman Podcast #341 – Guido van Rossum: Python and the Future of Programming Machine transcription by Qwen3-ASR 0.6B (MLX, local, Apache-2.0). May contain recognition errors. The following is a conversation with Guido van Rossum, his second time on this podcast. He is the creator of the Python programming language and is Python's Merida's BDFL, benevolent dictator for life. And now a quick few second mention of each sponsor. Check them out in the description. It's the best way to support this podcast. We got Give directly for philanthropy, Eight Sleep for naps, Fundrise for real estate investing, Inside Tracker for biodata and Athletic Greens for nutritional health. Choose wisely, my friends. And now onto the full ad reads. As always, no ads in the middle. I try to make these interesting, but if you skip them, please still check out our sponsors. I enjoy their stuff, maybe you will too. This show is brought to you by Give directly, a nonprofit that lets you send cash directly to the people that need it. Give directly donors include previous guests of this podcast, Jack Dorsey, Elon Musk, Vitalik Buterin, all of whom happen to be. Actually, not Jack. Jack only has been on once, but I am pretty sure he's going to be on again many more times. He's a fascinating human being. Anyway, Elon too. He'll be back on soon, and of course, Vitalik as well. After the merge, anyway, all of that to say that the idea of giving directly to the people that need it is actually a really powerful way to help people. There is a lot of science. There is a lot of studies behind that that showed that getting cash directly to the people that need it is actually the best way to help them. So I think a lot of philanthropy is based on the idea that you could have a lot of middlemen and you kind of fund that chain that's able to optimally redistribute the funding. And okay, there might be some interesting aspects to that idea, but what I think is especially interesting is that when you remove all of those middlemen and you give directly to the people that need it is actually really effective. I frankly love that idea. You can visit givedirectly dot org slash lex to learn more and send cash directly to someone living in extreme poverty. That's givedirectly dot org slash lex. This episode is also brought to you by Eight Sleep and its new Pod Three mattress. I love taking naps. I got very little sleep last night. I just had a crazy pile of tasks to finish, and I had a crazy busy day today. So after I am done recording these very words that I am speaking to you, I am going to go lay down on an eight sleep bed, cold mattress, warm blanket, and I am going to pass out. For twenty twenty five thirty minutes, and I am going to as opposed to feeling a little bit tired, a little bit mentally exhausted, you know, maybe a little bit not so motivated to do work. I am going to feel like a new human being, excited to get right back into the trenches of programming and taking on the rest of the day, just powering through, super productive. All of that. Thank you to a comfortable, enriching, joyful nap. Check it out and get special holiday savings of up to four hundred dollars when you go to eightsleep dot com slash lex. This episode is also brought to you by Fundrise, spelled F U N D R I S E. It's a platform that allows you to invest in private real estate. As you know, looking at different markets and investment opportunities and all the crazy financial stuff that's going out there in the world. I think it's a good idea to diversify, and that's why private real estate is an interesting place to diversify in. And of course, when you do that kind of diversification, you should be using the services that make it super easy. You don't need to be an expert in what it's required in this kind of investment. You don't need to go through super complicated paperwork and so on. They vet everything for you. They figure out what are good real estate projects to invest in and make it super easy for you to do so. Over one hundred and fifty thousand investors use it. Check it out. It takes just a few minutes to get started at fundrise dot com slash lex. This show is also brought to you by Inside Tracker, a service I use to track biological data that comes from my body is fed in as the raw signal into machine learning algorithms, the DNA data, fitness tracker data, blood data, all that kind of stuff. Goes into the machine learning algorithm and gives a prediction, a recommendation about what I should do with my diet and lifestyle changes. This is obviously the early steps in what will make the twenty first century incredible, which is the personalization, the deep personalization, both medicine, lifestyle, diet, everything, career choices, mentorship, everything. Should be coming from rich raw signal coming from your body, maybe one day coming from your brain if you have BCI, brain computer interfaces like Neuralink operating. This is such an exciting future. So I am a huge supporter of this kind of future if it's done right if it's done in a way that respects people's privacy and people's rights. This is really really a great way to help individuals optimize their life. And get special savings for a limited time when you go to insidetracker dot com slash lex. This show is also brought to you by Athletic Greens and its AG One drink, which is an all in one daily drink to support better health and peak performance. It's my Zen temple that I return to twice a day. After a cup of coffee, it's the first thing I drink every day. I also drink it after a long run, and it gives me a certainty that I have all my nutritional bases covered. So all the crazy kind of diet stuff I am doing if I am fasting, if I am doing one meal a day, if I am doing carnivore just a little carb, all that kind of stuff, or if I am fasting for multiple days, or if I am doing crazy stretches of work or exercise. So both the mental and the physical fatigue that everything I am doing to my body in terms of challenging it, I know I have that basis covered and so it's it's not it's like a multivitamin but amazing multivitamin. I highly highly recommend it, and plus it also tastes good. They'll give you one month supply of fish oil when you sign up at athleticgreens dot com slash lex. This is the lex Friedman podcast to support it. Please check out our sponsors in the description. And now dear friends, here is Guido van Rossum. Python three dot eleven is coming out very soon. In it, C Python claim to be ten to sixty percent faster. How do you pull that off? And what's C Python? C Python is the last Python implementation standing, also the first one that was ever created, the original Python implementation that I started over thirty years ago. So what does it mean that Python, the programming language, is implemented in another programming language called C? What kind of audience do you have in mind here? People who know programming. No, there is somebody on a boat that's into fishing and have never heard about programming, but also some world class programmers. You are going to have to speak to both. Imagine a boat with two people, one of them has not heard about programming is really into fishing and the other one is like an incredible Silicon Valley programmer that's programmed in everything. C C plus plus Python Rust Java knows the entire history of programming languages, so you are going to have to speak to both. I imagine that boat in the middle of the ocean. I am going to please the guy who knows how to fish first. Yes, please. He seems like the most useful in the middle of the ocean. You got, you got to make him happy. I am sure he has a cell phone, so he's probably very suspicious about what goes on in that cell phone, but he must have heard that inside a cell phone is a tiny computer and a programming language is computer code that tells the computer what to do. It's a very low level language. It's zeros and ones, and then there is assembly, and then. Oh, yeah, we don't talk about these really low levels because those just confuse people. I mean, when we're talking about human language, we're not usually talking about vocal tracts and how you position your tongue. I was talking yesterday about how when you have a Chinese person and they speak English, this is a bit of a stereotype. They often don't know or they can't can't seem to make the difference well between an L and an R. And I have a theory about that, and I've never checked this with linguists. That it probably has to do with the fact that in Chinese there is not really a difference, and it could be that there are regional variations in how native Chinese speakers pronounce that one sound that. Sounds to L to some like L to some of them like R to others. So it's both the sounds you produce with your mouth throughout the history of your life and what you are used to listening to. I mean every language has that Russian has. Exactly, the Slavic languages have sounds like the letter J. Like Americans or English speakers don't seem to know the sound J. They seem uncomfortable with that sound. Yeah, so I am. Oh yes, okay, so we're not we're not going to the shapes of tongues and the sounds that the mouth can make. Fine, words. Similarly, we're not going into the ones and zeros or machine language. I would say a programming language is a list of instructions like a cookbook recipe that sort of tells you how to do a certain thing, like make a sandwich. Well, acquire a loaf of bread, cut it in slices, take two slices, put mustard on one, put jelly on the other or something, then add the meat, then add the cheese. I've heard that science teachers can actually do great stuff with recipes like that and trying to interpret their students' instructions incorrectly until the students are completely unambiguous about it. With language, see that's the difference between natural languages and programming languages. I think ambiguity is a feature, not a bug in human spoken languages. Like that's the dance of communication between humans. Well, for lawyers, ambiguity certainly is a feature. For plenty of other cases, the ambiguity is is not much of a feature, but we work around it, of course. Well, what's more important is context. So with context, the precision of the statement becomes more and more concrete, right? But you know when you say, "I love you" to a person that matters a lot to you, the person doesn't try to compile that statement and return an error saying, "Please define love." Right? No, but I imagine that my wife and my son interpreted very differently. Yes, even though it's the same three words, but imprecisely still. Oh, for sure. Lawyers never a lot of follow up questions for you. Nevertheless, the context is already different different in that case. Yes, fair enough. So that that's a programming language is a ability to unambiguously state a recipe. Actually, let's go back. Let's go to Peppe. You go through in Peppe the style guy for Python code, some ideas of what this language should look like, feel like, read like, and the big idea there is that code readability counts. What does that mean to you? And how do we achieve it? So this recipe should be readable. That's a thing between programmers. Because on the one hand, we always explain the concept of programming language as computers need instructions and computers are very dumb and they need very precise instructions because they don't have much context in in fact they have lots of context but their their context is very different. But what we've seen emerge during the development of software starting in the probably in the late forties is that software is a very social activity. A software developer is not a mad scientist who sits alone in his lab writing brilliant code. A software is developed by teams of people. Even the mad scientist sitting alone in his lab can type fast enough to produce enough code so that by the time he's done with his coding, he still remembers what the first few lines he wrote mean. So even the mad scientist coding alone in his lab would would be sort of wise to. Adopt conventions on how to format the instructions that he gives to the computer so that the thing is there is a difference between a cookbook recipe and a computer program. The cookbook recipe, the the author of the cookbook writes it once and then it's printed in one hundred thousand copies and then lots of people in their kitchens try to recreate that recipe that that that particular. Pie or dish from the recipe, and so there the the goal of the cookbook author is to make it clear to the human reader of the recipe, the human amateur chef in most cases. When you are writing a computer program, you have two audiences at once. It needs to tell the computer what to do, but it also is useful if that program is readable by other programmers. Because computer software, unlike the typical recipe for a cherry pie, is so complex that you don't get all of it right at once. You end up with the activity of debugging, and you end up with the activity of so debugging is. Trying to figure out why your code doesn't run the way you thought it should run. That means broadly, it could be stupid little errors or it could be big logical errors. It could be anything. Spiritual. Yeah, it could be anything from a typo to a wrong choice of algorithm to building something that does what you tell it to do, but that's not useful. Yeah, it seems to work really well ninety nine percent of the time, but does weird things one percent of the time on some edge cases. That's pretty much all software nowadays. All good software, right? Well, yeah, for for bad software that ninety nine goes down a lot. So, but it's not just about the complexity of the program. It's like you said, it is a social endeavor in that you are constantly improving that recipe for the cherry pie. But you are sort of you are in a group of people improving that recipe, or the mad scientist is improving the recipe that he created a year ago and making it better. Or adding adding something, he decides that he wants a, I don't know, he wants some decoration on his pie or icing or. So there is broad philosophical things and there is specific advice on style. So first of all, the thing that people first experience when they look at Python, there is a it is very readable, but there is also like a spatial structure to it. Can you explain the indentation style of Python and what is the magic to it? Spaces are important for readability of any kind of text. If you take a cookbook recipe and you remove all the sort of all the bullets and other markup, and you just crunch all the text together, maybe you leave the spaces between the words, but that's all you leave. When you are in the kitchen trying to figure out, oh, what are the ingredients and what are the steps and where does this step end and the next step begin, you are going to have a hard time if it's if it's just one solid block of text. On the other hand, what what a typical cookbook does if the paper is not too expensive, each recipe starts on its own page. Maybe there is a picture next to it. The list of ingredients comes first. There is a standard notation. There is there is shortcuts so that you don't have to sort of write two sentences on how you have to cut the onion because there are only three ways that people ever cut onions in a kitchen: small, medium, and in slices or something like that. Right, none of my examples make any sense to real cooks, of course, but yeah, we're talking to programmers with the metaphor of cooking. I love it, but there is a strictness to the spacing that Python defines. So there is some looser things, some stricter things, but the four spaces for the for the indentation is really interesting. It it really it really defines what the language looks and feels like. Because indentation sort of taking a block of text and then having inside that block of text a smaller block of text that is indented further as sort of a group, it's it's it's like you have a bulleted list. In a complex business document, and inside some of the bullets are other bulleted lists. You will indent those too. If each bulleted list is indented several inches, then at two levels deep, there is no no space left on the page to put any of the words of the text. So you can't indent too far. On the other hand, if you don't indent at all, you can tell whether something is a top level bullet or a second level bullet or a third level bullet. So you have to have some compromise and based on ancient conventions and sort of the typical width of a computer screen in the eighties. And all sorts of things sort of. We we came up with sort of four spaces as a compromise. I mean there there are groups, there are large groups of people who code with two spaces per indent level. For example, the Google style guide, all the Google Python code, and I think also all the Google C plus plus code is indented with only two spaces per block. If you are not used to that, it's harder to at a glance. Understand the code because the the sort of the the high level structure is determined by the indentation. On the other hand, there are there are other programming languages where the indentation is eight spaces or a whole tab stop in in sort of classic Unix. And to me that looks weird because you you sort of after three indent levels you've you've got no room left. Well, there is some languages where the indentation is a recommendation, a stylistic one. The code compiles even without any indentation, and then Python really indentation is a fundamental part of the language, right? It doesn't have to be four spaces, so you you can code Python with two spaces per block or or or six spaces or twelve if you really want to go wild, but. Sort of everything that belongs to the same block needs to be indented the same way. In practice, in most other languages, people recommend doing that anyway. If you look at C or Rust or C plus plus, all those languages Java don't have a requirement of indentation. But except in extreme cases, they're just as anal about having their code properly indented. So any IDE that the syntax highlighting that works with Java or C plus plus they will yell at you aggressively if you don't do proper indentation. They suggest the proper indentation for you, like in C you type a few words and then you type curly brace which there is their notion of sort of begin an indented block. Then you hit return and then it automatically indents four or eight spaces depending on your your style preferences or how your editor is configured. Was there a possible universe in which you considered having braces in Python? Absolutely, yeah. What was the sixty forty seventy thirty in your head? What was the trade off? For a long time, I was actually convinced that the indentation was just better. Without context, I would still claim that indentation is better. It reduces clutter. However, as I started to say earlier, context is almost everything. And in the context of coding, most programmers are familiar with multiple languages even if they are only good at one or two. And apart from Python and maybe Fortran I don't know how that's written these days anymore but. All the other languages Java Rust C plus plus JavaScript TypeScript Perl are all using curly braces to sort of indicate blocks. And so Python is the odd one out. So it's a radical idea. Do you still as a radical renegade revolutionary do you still stand behind this idea of space of indentation versus braces? Like what what can you dig into it a little bit more? Why you still stand behind indentation? Because context is not the whole story. History in in a sense provides more context. So for Python. There is no chance that we can switch. Python is using curly braces for something else. Dictionary is mostly. We would get in trouble if we wanted to switch, just like you couldn't redefine C to use indentation even if you agree that that indentation sort of. In a greenfield environment would be better. You can't change that kind of thing in a language. It's hard enough to reach agreement over over much more minor details. Maybe I mean in the past in Python we did have a big debate about tabs versus spaces and four spaces versus fewer or more. And we sort of came up with a recommended standard and sort of options for people who want to be different. But yes, I guess the thought experiment I'd like you to consider is if you could travel back through time when the when the compatibility is not an issue. You start a Python all over again. Can you make the case for indentation still? Well, it frees up a pair of matched brackets of which there are never enough in the world for other purposes. Really makes the language slightly sort of easier to grasp for people who don't already know. Another programming language because the sort of one of the things and I I mostly got this from my mentors who. Taught me programming language design in the earlier eighties. When you are teaching programming for for the the total newbie who has not. Code it before in not in any other language. A whole bunch of concepts in programming are very alien or. Sort of new and and may be very interesting but also distracting and confusing and there are many different things you have to learn you have to sort of. In a typical thirteen week programming course, you have to if if it's like really. Learning to program from scratch, you have to cover algorithms, you have to cover data structures, you have to cover syntax, you have to cover variables, loops, functions, recursion, classes. Expressions operators. There are so many concepts if you you sort of if you can spend a little less time. Having to worry about the syntax, the classic example was often. Oh, the compiler complains every time I put a semi colon in the wrong place or I forget to put a semi colon. Python doesn't have semi colons in that sense, so you can't forget them and you are also not. Sort of misled into putting them where they don't belong because you don't learn about them in the first place. The flip side of that is forcing the strictness onto the beginning programmer to teach them that programming is. Values attention to details you don't get to just write the way you write in English. Plenty of other details that they have to pay attention to so I think they'll they'll still get the message about. Paying attention to detail. The interesting design choice. So I still program quite a bit in PHP and I am sure there is other languages like this but the dollar sign before a variable. That was that was an annoying thing for me. It didn't quite fit into my understanding of why this is good for a programming language. I am not sure if you ever thought about that one. That is a historical thing. There is a whole lineage of programming languages. PHP is one. Perl was one. The Unix shell is one of the oldest or or all the different shells. The dollar was invented for that purpose because the very earliest shells had a notion of scripting but they did not have a notion of parameterizing the scripting. Right and so a script is just a few lines of text where each line of text is a command that is read by a very primitive command processor that then sort of takes the first word on the line as the name of a program and passes all the all the rest. Of the line as text into the program for the program to figure out what to do with as arguments. And so by the time scripting was slightly more mature than the very first script. There was a convention that just like the first word on the line is the name of the program, the following words. Could be names of files, input dot text, output dot HTML things like that. The next thing that happens is oh it would actually be really nice if we could have variables and especially parameters for scripts. Parameters are usually what starts this process. But now you have a problem because you can't just say the parameters are x y and z. And so now we we call say let's say x is the input file and y is the output file and let forget about z for now. I have my program. And I write program x y well that already has a meaning because that presumably means. X itself is the file. It's a file name. It's not a variable name. And so the inventors of of things like the Unix shell and I am sure Job Command language in at IBM before that. Had to use something that made it clear to the script processor. Here is an X that is not actually the name of a file which you just pass through to the. To the program you are running, here is an X that is the name of a variable. And when you are writing a script processor, you try to keep it as simple as possible. Because as certainly in the the fifties and sixties. The thing that interprets the script was itself a very had to be a very small program because it had to fit in a very small part of memory. And so saying oh just look at each character and if you see a dollar sign you jump to another section of the code and then you gobble up characters or say until the next space or something. And you say that's the variable name. And so it was was sort of. Invented as a clever way to make parsing of things that contain both variable and fixed parts. Very easy in a very simple script processor. It also helps even then it also helps the human. Author and the human reader of the the script to quickly see oh twenty lines down in the script I see a reference to xyz oh it has a dollar in front of it so now we know that xyz must be one of the parameters of the script. Well this is fascinating several things to say which is. The leftovers from the simple script processor languages are now in code bases like behind Facebook or behind most of the backend I think PHP is probably still runs most of the backend of the internet. Oh yeah yeah I think there is a lot of it in Wikipedia too for example. It's funny that those decisions are not funny it's fascinating that those decisions permeate through time. Just like biological systems, right? I mean that the sort of the inner workings of DNA. Have been stable for well I don't know how long it was like three hundred million years half a billion years. And there there are all sorts of weird quirks there. That don't make a lot of sense if you were to design a system like self replicating molecules from scratch. Well that system has a lot of interesting resilience. It has redundancy that results like it messes up in interesting ways that still is resilient when you look at the system level of the organism. Code doesn't necessarily have that a program a computer programming code. You'd be surprised how much resilience modern code has. I mean if you if you look at the number of bugs per line of code. Even in in very well tested code that in practice works just fine, there are actually lots of things that don't work fine. And there are error correcting or self correcting mechanisms at many levels including probably the user of the code. Well in the end the user who sort of is told well you got to reboot your your PC is part of that system. And a slightly less drastic thing is reload page which we all know how to do without thinking about it when something weird happens you you try to reload a few times before you say oh there is something really weird. Okay or try to click the button again if the first time didn't work. Well yeah that that we should all have learned not to do that because that's probably just going to turn the light back off. Yeah true so do it three times that's the that's the right lesson so. And I wonder how many people actually like the dollar sign like you said it is documentation so to me it's whatever the opposite of syntactic sugar is syntactic poison. To me it is such a pain in the ass that I have to type in a dollar sign also super error prone. So it's not self documenting it's it's like a bug generating thing it is a kind of documentation that's the pro and the con is it's a source of a lot of bugs but actually I have to ask you um. This is a really interesting idea of bugs per line of code. If you look at all the computer systems out there from the code that runs nuclear weapons to the code that runs all the amazing companies that you've been involved with and not. The code that runs Twitter and Facebook and Dropbox and Google and Microsoft Windows and so on. And we like laid out. Wouldn't that be a cool like table bugs per line of code and what let's let's put like actual companies aside. Do you think we'd be surprised by the number we see there for all these companies? That depends on whether you've ever read about research that's been done in this area before. And I don't know the the the last time I I saw some research like that that was probably in the nineties and the research might have been done in the eighties. But the the conclusion was across a wide range of different software, different languages, different companies, different development styles. The number of bugs is always I think it's in the order of about one bug per thousand lines in sort of. Mature software that that is considered interesting as good as it gets. Can I give you some facts here? There is a lot of good papers. So you said mature software right so here is a. A report from a like programming analytics company. Now this is from a developer perspective. Let me just say what it says because this is very weird and surprising. On average, a developer creates seventy bugs per one thousand lines of code. Fifteen bugs per one thousand lines of code find their way to the customers. This is in software they've. Oh I was I was wrong by an order. I am going to order there. Fixing a bug takes thirty times longer than writing a line of code. That I can believe. Yeah. Seventy five percent of a developer's time is spent on debugging. That's for an average developer that they analyze is fifteen argue. Fifteen hundred hours a year in US alone one hundred and thirteen billion dollars to spend annually on identifying and fixing bugs. And I imagine this is marketing literature for someone who claims to have a golden bullet or a silver bullet that makes all that investment in fixing bugs go away but that that is usually not going to. Yeah that's not going to happen. Well they're I mean they're referencing a lot of stuff of course but it is a page that is you know there is a contact us button at the bottom presumably if you just. Spend a little bit less than one hundred billion dollars we're willing to solve the problem for you. Right and there is also a report on stock exchange it's Stack Overflow on the exact same topic but when I open it up at the moment the page says Stack Overflow is currently offline for maintenance. Oh that is ironic yes. By the way their error page is awesome anyway. I mean can you believe that number of bugs? Oh absolutely. Isn't that scary that seventy bugs per one thousand lines of code so even ten bugs per thousand lines. Well that's about one bug after every fifteen lines and that's when you are first typing it in. Yeah from a developer but like how many bugs are going to be found if you are if you are typing. Well the development process is extremely iterative. Typically you don't make a plan for what software you are going to release a year from now. Yeah and work out all the details because actually all the details themselves consist. They sort of compose a program and that that being a program all your plans will have bugs in them too. And inaccuracies. But what what you actually do is. You do a bunch of typing and I am I am actually really I am a really bad typist. That just I've never learned to type with ten fingers. How many do you use? Well I use all ten of them but not very well. But I I never I never took a typing class and I never sort of corrected that so the first time I I seriously learned I had to learn the layout of a of a QWERTY keyboard. Was actually in college in my first programming classes, where we used punch cards. And so, with my two fingers, I sort of pecked out my code. Watch anyone give you a little coding demonstration. They'll have to produce like four lines of code, and now see how many times they use the backspace key. Because they made a mistake, and and. And some people, especially when when someone else is looking, will will backspace over twenty, thirty, forty characters to fix a typo earlier in the line. If you're. If you're slightly more experienced, of course you use your arrow buttons to go or your mouse to, but the mouse is usually slower than than the arrows. But a lot of people, when they type a twenty character word, which is not unusual, and they realize they made a mistake at the start of the word, they backspace over the whole thing. And then retype it, and sometimes it takes three, four times to get it right. So. I don't know what your definition of bug is. Arguably, mistyping a word and then correcting it immediately is not a bug. On the other hand, you you already. Do sort of lose time, and every once in a while there's sort of a typo that you don't get in that process. And now you've you've you've typed like ten lines of code, and somewhere in the middle of it you don't know where yet is a typo or. Maybe a thing oh where you you forgot that you had to initialize a variable or something. But those are two different things, and I would say yes, you have to actually run the code to discover that typo, but forgetting to initialize a variable is a fundamentally different. Thing because that thing can go undiscovered. That depends on the language in Python. It will not. Right, and sort of modern compilers are usually pretty good at catching that even. Even foresee. So for that specific thing, but actually deeper, it might there might be another variable that has initialized, but logically speaking, the one you meant related. Yep. It's like name the same, but it's a different thing, and you forgot to initialize whatever some counter or some some basic variable they're using. I can tell that you've coded. Yes. By the way, I should mention that I use a Kinesis keyboard, which has the backspace under the thumb, and one of the biggest reasons. I use that keyboard is because you realize in order to use the backspace on a usual keyboard you have to stretch your pinky out. And like. The for most normal keyboards, the backspace is under the pinky, and so I don't know if people realize the pain they go through in their life. Because of the backspace key being so far away, so with the Kinesis it's right under the thumb, so you don't have to actually move your hands. The backspace in the delete. What do you do if you're ever not with your own keyboard and you have to use someone else's PC keyboard that has a standard layout? So first of all, it turns out that you can actually go your whole life always having a keyboard. With you, so this well except for that that little tablet that you're using sort of note taking right now, right? Yeah, so it's very inefficient note taking, but I'm not I'm just looking stuff up. But in most cases, I would be actually using the keyboard here. Right now, I just don't anticipate you have to calculate how much typing do you anticipate. If I anticipate quite a bit, then I'll just I have a keyboard. You pull it out. And same same with it. I mean. The embarrassing, I've accepted being the weirdo that I am, but you know when I go on an airplane and I anticipate to do programming or a lot of typing, I will have a laptop and I will pull out a Kinesis keyboard. In addition to the laptop, and it's just who I am. You have to you have to accept who you are. But also, it's you know for a lot of people, for me certainly there's a comfort space. Where there's certain kind of setups that are maximize productivity. And it's like some people have a warm blanket that they like when they watch a movie. I like the Kinesis keyboard. It takes me to a place of focus, and I still mostly. I I'm trying to make sure I use the state of the art IDEs for everything, but my comfort place just like the Kinesis keyboard is still Emacs. So I still use I still I mean that's one of some of the debates I have with myself about everything from a technology perspective. Is how much to hold on to the tools you're comfortable with versus how much to invest in using modern tools, and the signal that the communities provide you with. Is the noisy one because a lot of people year to year get excited about new tools and you have to make a prediction. Are these tools defining a new generation or something that will transform programming, or is this just a fad that will pass? Certainly with JavaScript frameworks and front end and back end of the web. There's a lot of different styles that came and went. I remember learning. What was it called? Action script. I remember for Flash, you know learning how to program in Flash, learning how to design doing graphic animation all that kind of stuff in Flash. Same with Java applets. I remember creating quite a lot of Java applets thinking that this potentially defines the future of the web. And it did not. Well, you know in most cases like that, the particular technology eventually gets replaced. But many of the concepts that the technology introduced or made accessible first. Are preserved, of course, because yeah we're not using Java applets anymore, but the notion of reactive web pages. That sort of contain little bits of code that respond directly to. Something you do, like pressing a button or a link or hovering, even is has certainly not gone away, and that those animations that were. Made painfully complicated with Flash. I mean, Flash was an innovation when it first came up, and when it was replaced by JavaScript equivalents stuff. It was a somewhat better way to do animations, but those animations are still there—not all of them, but but sort of. Again, there is an evolution, and often so often with technology. That the sort of the technology that was eventually thrown away or replaced. Was still essential to to sort of get started. There wouldn't be jet planes without propeller planes. I bet you. But from a user perspective, yes, from the feature set, yes, but I from a programmer perspective, it feels like. All the time I've spent with Action Script, all the time I've spent

本集資源與出處