語言技術:Python Gossip
Beautiful is better
than ugly.
Explicit is better
than implicit.
Simple is better
than complex.
Complex is better
than complicated.
Flat is better
than nested.
Sparse is better
than dense.
Readability counts.
Special cases
aren't special enough to break the rules.
Although
practicality beats purity.
Errors should
never pass silently.
Unless explicitly
silenced.
In the face of
ambiguity, refuse the temptation to guess.
There should be
one-- and preferably only one --obvious way to do it.
Although that way
may not be obvious at first unless you're Dutch.
Now is better than
never.
Although never is
often better than *right* now.
If the
implementation is hard to explain, it's a bad idea.
If the
implementation is easy to explain, it may be a good idea.
Namespaces are one
honking great idea -- let's do more of those!
The Zen of Python,
by Tim Peters
文件基於 Python 3 撰寫
- 起步走
從一些簡單的語法與型態開始,了解 Python 內建特性,這已經足夠讓你作不少運算了。
指令互動環境可以讓你隨時測試一些小程式,基本輸出入讓你了解如何以程式與使用者互動並儲存結果。
常用的物件都是語法內建,語法簡潔且功能豐富。
Python 是動態語言,所有資料都是物件。
基本的流程語法不多,但可以作的事很多。
- 函式、類別與模組
封裝演算、定義物件行為、組織程式元件。
def 是陳述句,函式是物件。
是物件的共同定義,也是個名稱空間。
是個檔案,也是個功能元件。
- 進階議題
一些知道會更好的東西。
凡事有例外,有些是對的,有些是錯的,好好處理就是。
物件上的特性不受控制嗎?其實你可以的。。XD
在不改變其它程式的前題下,增加程式的功能。
在建立 type 實例之前,你可以作一些有的沒的。。XD
- 參考資料
|
|