Skip to content

Commit 0cc8df4

Browse files
committed
Translate faq/design.html#why-does-python-use-methods-for-some-functionality-e-g-list-index-but-functions-for-other-e-g-len-list
1 parent 66257ea commit 0cc8df4

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

faq/design.po

+12-1
Original file line numberDiff line numberDiff line change
@@ -303,10 +303,12 @@ msgid ""
303303
"Why does Python use methods for some functionality (e.g. list.index()) but "
304304
"functions for other (e.g. len(list))?"
305305
msgstr ""
306+
"為何 Python 對於一些功能實作使用方法(像是 list.index()),另一些使用函式(像"
307+
"是 len(list))?"
306308

307309
#: ../../faq/design.rst:171
308310
msgid "As Guido said:"
309-
msgstr ""
311+
msgstr "如吉多所說:"
310312

311313
#: ../../faq/design.rst:173
312314
msgid ""
@@ -316,6 +318,10 @@ msgid ""
316318
"problem. Compare the easy with which we rewrite a formula like x*(a+b) into "
317319
"x*a + x*b to the clumsiness of doing the same thing using a raw OO notation."
318320
msgstr ""
321+
"(一) 對一些運算來說,前綴寫法看起來會比後綴寫法好 ── 前綴(和中綴!)運算在"
322+
"數學上有更久遠的傳統,這些符號在視覺上幫助數學家們更容易思考問題。想想把 x*(a"
323+
"+b) 這種式子展開成 x*a+x*b 的簡單,再比較一下古老的圈圈符號記法的笨拙就知道"
324+
"了。"
319325

320326
#: ../../faq/design.rst:180
321327
msgid ""
@@ -328,6 +334,11 @@ msgid ""
328334
"mapping has a get() or keys() method, or something that isn't a file has a "
329335
"write() method."
330336
msgstr ""
337+
"(二) 當我看到一段程式碼寫著 len(x),我*知道*他要找某個東西的長度。這告訴了"
338+
"我兩件事:結果是一個整數、參數是某種容器。相對地,當我看到 x.len(),我必須先"
339+
"知道 x 是某種容器,並實作了一個介面或是繼承了一個有標準 len() 的類別。遇到一"
340+
"個沒有實作映射 (mapping) 的類別卻有 get() 或 keys() 方法,或是不是檔案但卻有 "
341+
"write() 方法時,我們偶爾會覺得困惑。"
331342

332343
#: ../../faq/design.rst:189
333344
msgid "https://mail.python.org/pipermail/python-3000/2006-November/004643.html"

0 commit comments

Comments
 (0)