@@ -235,7 +235,6 @@ msgstr ""
235235"綴 ``m_``,所以這種明確性在那些語言也是很好用的。"
236236
237237#: ../../faq/design.rst:127
238- #, fuzzy
239238msgid ""
240239"Second, it means that no special syntax is necessary if you want to "
241240"explicitly reference or call the method from a particular class. In C++, if "
@@ -249,8 +248,8 @@ msgstr ""
249248"第二,當你想明確地使用或呼叫在某個類別裡的方法的時候,你不需要特殊的語法。在 "
250249"C++ 裡,如果你想用一個在繼承類別時被覆寫的基底類別方法,必須要用 ``::`` 運算"
251250"子 -- 但在 Python 裡,你可以直接寫成 ``baseclass.methodname(self, <argument "
252- "list>)``。這在 :meth:`__init__` 方法很好用,特別是在一個繼承的類別要擴充基底 "
253- "類別的方法而要呼叫他時 。"
251+ "list>)``。這在 :meth:`~object. __init__` 方法很好用,特別是在一個繼承的類別要 "
252+ "擴充基底類別的方法而要呼叫他時 。"
254253
255254#: ../../faq/design.rst:136
256255msgid ""
@@ -425,14 +424,14 @@ msgid "How fast are exceptions?"
425424msgstr "例外處理有多快?"
426425
427426#: ../../faq/design.rst:235
428- #, fuzzy
429427msgid ""
430428"A :keyword:`try`/:keyword:`except` block is extremely efficient if no "
431429"exceptions are raised. Actually catching an exception is expensive. In "
432430"versions of Python prior to 2.0 it was common to use this idiom::"
433431msgstr ""
434- "如果沒有例外被丟出,一個 try/except 區塊是非常有效率的。事實上,抓捕例外要付"
435- "出昂貴的代價。在 Python 2.0 以前,這樣使用是相當常見的:\n"
432+ "如果沒有例外被丟出,一個 :keyword:`try`/:keyword:`except` 區塊是非常有效率"
433+ "的。事實上,抓捕例外要付出昂貴的代價。在 Python 2.0 以前,這樣使用是相當常見"
434+ "的:\n"
436435"\n"
437436"::"
438437
@@ -613,16 +612,15 @@ msgstr ""
613612"::"
614613
615614#: ../../faq/design.rst:355
616- #, fuzzy
617615msgid ""
618616"Indeed, using CPython's reference counting and destructor scheme, each new "
619617"assignment to ``f`` closes the previous file. With a traditional GC, "
620618"however, those file objects will only get collected (and closed) at varying "
621619"and possibly long intervals."
622620msgstr ""
623- "實際上,使用 CPython 的參照計次和解構方案 (destructor scheme),每個對\\ "
624- "*f* \\ 的新指派都會關閉前面打開的檔案。然而用傳統的垃圾回收 (GC) 的話,這些檔 "
625- "案物件只會在不固定且有可能很長的時間後被收集 (並關閉)。"
621+ "實際上,使用 CPython 的參照計次和解構方案 (destructor scheme),每個對 ``f`` "
622+ "的新指派都會關閉前面打開的檔案。然而用傳統的垃圾回收 (GC) 的話,這些檔案物件 "
623+ "只會在不固定且有可能很長的時間後被收集 (並關閉)。"
626624
627625#: ../../faq/design.rst:360
628626msgid ""
@@ -653,7 +651,6 @@ msgstr ""
653651"大多數是通透的,也並不完全,要讓它跟 Python 相容還是需要做一些修補。)"
654652
655653#: ../../faq/design.rst:378
656- #, fuzzy
657654msgid ""
658655"Traditional GC also becomes a problem when Python is embedded into other "
659656"applications. While in a standalone Python it's fine to replace the "
@@ -664,10 +661,10 @@ msgid ""
664661"``free()`` properly."
665662msgstr ""
666663"傳統的垃圾收集 (GC) 在 Python 被嵌入其他應用程式時也成了一個問題。在獨立的 "
667- "Python 程式裡當然可以把標準的 malloc() 和 free() 換成 GC函式庫提供的其他版 "
668- "本 ;但一個嵌著 Python 的應用程式可能想用\\ *自己*\\ 的 malloc() 和free() 替 "
669- "代品 ,而不是用 Python 的。以現在來說,CPython 和實作 malloc() 和free() 的程 "
670- "式相處融洽 。"
664+ "Python 程式裡當然可以把標準的`` malloc()`` 和`` free()`` 換成 GC函式庫提供的 "
665+ "其他版本 ;但一個嵌著 Python 的應用程式可能想用\\ *自己*\\ 的 malloc() 和 "
666+ "free() 替代品 ,而不是用 Python 的。以現在來說,CPython 和實作 malloc() 和 "
667+ "free() 的程式相處融洽 。"
671668
672669#: ../../faq/design.rst:387
673670msgid "Why isn't all memory freed when CPython exits?"
@@ -700,7 +697,6 @@ msgid "Why are there separate tuple and list data types?"
700697msgstr "為何要把元組 (tuple) 和串列 (list) 分成兩個資料型態?"
701698
702699#: ../../faq/design.rst:403
703- #, fuzzy
704700msgid ""
705701"Lists and tuples, while similar in many respects, are generally used in "
706702"fundamentally different ways. Tuples can be thought of as being similar to "
@@ -710,12 +706,11 @@ msgid ""
710706"two or three numbers."
711707msgstr ""
712708"串列和元組在很多方面相當相似,但通常用在完全不同的地方。元組可以想成 Pascal "
713- "的紀錄 ( record) 或是 C的結構 ( struct),是一小群相關聯但可能是不同型別的資料 "
714- "集合 ,以一組為單位進行操作。舉例來說,一個笛卡兒坐標系可以適當地表示成一個有 "
715- "二或三個值的元組 。"
709+ "的 `` record`` 或是 C的 `` struct``,是一小群相關聯但可能是不同型別的資料集 "
710+ "合 ,以一組為單位進行操作。舉例來說,一個笛卡兒坐標系可以適當地表示成一個有二 "
711+ "或三個值的元組 。"
716712
717713#: ../../faq/design.rst:410
718- #, fuzzy
719714msgid ""
720715"Lists, on the other hand, are more like arrays in other languages. They "
721716"tend to hold a varying number of objects all of which have the same type and "
@@ -725,8 +720,9 @@ msgid ""
725720"if you added another file or two to the directory."
726721msgstr ""
727722"另一方面,串列更像是其他語言的陣列 (array)。他可以有不固定個同類別物件,且為"
728- "逐項操作。舉例來說,``os.listdir('.')`` 回傳當下目錄裡的檔案,以包含字串的串"
729- "列表示。如果你新增了幾個檔案到這個目錄,一般來說操作結果的函式也會正常運作。"
723+ "逐項操作。舉例來說,:func:`os.listdir('.') <os.listdir>` 回傳當下目錄裡的檔"
724+ "案,以包含字串的串列表示。如果你新增了幾個檔案到這個目錄,一般來說操作結果的"
725+ "函式也會正常運作。"
730726
731727#: ../../faq/design.rst:418
732728msgid ""
@@ -787,7 +783,6 @@ msgstr ""
787783"tree),在搜尋(目前為止最常見的操作)方面有更好的表現,實作上也較為簡單。"
788784
789785#: ../../faq/design.rst:447
790- #, fuzzy
791786msgid ""
792787"Dictionaries work by computing a hash code for each key stored in the "
793788"dictionary using the :func:`hash` built-in function. The hash code varies "
@@ -800,10 +795,10 @@ msgid ""
800795"notation -- to retrieve a key."
801796msgstr ""
802797"字典利用內建 :func:`hash` 函式,對每個鍵做雜湊計算。雜湊結果依據鍵的值和個別"
803- "執行緒 (processes) 的種子而有相當大的差距。例如,\" Python\" 的雜湊是 "
804- "-539294296,而只差一個字的\" python\" 則是 1142331976。雜湊結果接著被用來計算 "
805- "值在內部陣列儲存的位置 。假設你存的鍵都有不同的雜湊值,那字典只需要常數時間 — "
806- "用大 O 表示法 (Big-O notation) 就是 O(1) — 來找任意一個鍵。"
798+ "執行緒 (processes) 的種子而有相當大的差距。例如,``' Python'`` 的雜湊是 "
799+ "`` -539294296`` ,而只差一個字的``' python'`` 則是`` 1142331976``。雜湊結果接著 "
800+ "被用來計算值在內部陣列儲存的位置 。假設你存的鍵都有不同的雜湊值,那字典只需要 "
801+ "常數時間 — 用大 O 表示法 (Big-O notation) 就是 O(1) — 來找任意一個鍵。"
807802
808803#: ../../faq/design.rst:458
809804msgid "Why must dictionary keys be immutable?"
@@ -895,7 +890,6 @@ msgstr ""
895890"所有物件都標記成只能讀取 — 所以再一次,自己參照自己的物件會導致無窮迴圈。"
896891
897892#: ../../faq/design.rst:500
898- #, fuzzy
899893msgid ""
900894"There is a trick to get around this if you need to, but use it at your own "
901895"risk: You can wrap a mutable structure inside a class instance which has "
@@ -905,9 +899,9 @@ msgid ""
905899"the object is in the dictionary (or other structure). ::"
906900msgstr ""
907901"如果你需要的話,這裡有個小技巧可以幫你,但請自己承擔風險:你可以把一個可變物"
908- "件包裝進一個有 :meth:`__eq__` 和 :meth:`__hash__`方法的類別實例。只要這種包 "
909- "裝物件還存在於字典 (或其他類似結構)中,你就必須確定在字典(或其他用雜湊為基 "
910- "底的結構 )中他們的雜湊值會保持恆定。\n"
902+ "件包裝進一個有 :meth:`~object. __eq__` 和 :meth:`~object. __hash__`方法的類別 "
903+ "實例。只要這種包裝物件還存在於字典 (或其他類似結構)中,你就必須確定在字典"
904+ "(或其他用雜湊為基底的結構 )中他們的雜湊值會保持恆定。\n"
911905"\n"
912906"::"
913907
@@ -934,16 +928,15 @@ msgstr ""
934928"為基底的結構會出現不正常的行為。"
935929
936930#: ../../faq/design.rst:534
937- #, fuzzy
938931msgid ""
939932"In the case of :class:`!ListWrapper`, whenever the wrapper object is in a "
940933"dictionary the wrapped list must not change to avoid anomalies. Don't do "
941934"this unless you are prepared to think hard about the requirements and the "
942935"consequences of not meeting them correctly. Consider yourself warned."
943936msgstr ""
944- "至於 ListWrapper,只要這個包裝過的物件在字典中,裡面的串列就不能改變以避免不 "
945- "正常的事情發生 。除非你已經謹慎思考過你的需求和無法滿足條件的後果,不然請不要 "
946- "這麼做 。請自行注意。"
937+ "至於:class:`! ListWrapper` ,只要這個包裝過的物件在字典中,裡面的串列就不能改 "
938+ "變以避免不正常的事情發生 。除非你已經謹慎思考過你的需求和無法滿足條件的後果,"
939+ "不然請不要這麼做 。請自行注意。"
947940
948941#: ../../faq/design.rst:541
949942msgid "Why doesn't list.sort() return the sorted list?"
@@ -1028,7 +1021,6 @@ msgstr ""
10281021"用來建構詳盡徹底的測試套件來測試模組裡的每一行程式碼。"
10291022
10301023#: ../../faq/design.rst:584
1031- #, fuzzy
10321024msgid ""
10331025"An appropriate testing discipline can help build large complex applications "
10341026"in Python as well as having interface specifications would. In fact, it can "
@@ -1041,9 +1033,9 @@ msgid ""
10411033msgstr ""
10421034"就像介面規範一樣,一個適當的測試規則在建造大型又複雜的 Python 應用程式時可以"
10431035"幫上忙。事實上,他可能可以有更好的表現,因為介面規範無法測試程式的特定屬性。"
1044- "舉例來說,:meth:`append` 方法應該要在某個內部的串列最後面加上新的元素,而介面 "
1045- "規範沒辦法測試你的 :meth:`append` 是不是真的有正確的實作,但這在測試套件裡是 "
1046- "件很簡單的事 。"
1036+ "舉例來說,:meth:`list. append` 方法應該要在某個內部的串列最後面加上新的元素,"
1037+ "而介面規範沒辦法測試你的 :meth:`list. append` 是不是真的有正確的實作,但這在測 "
1038+ "試套件裡是件很簡單的事 。"
10471039
10481040#: ../../faq/design.rst:592
10491041msgid ""
@@ -1062,7 +1054,6 @@ msgid "Why is there no goto?"
10621054msgstr "為何沒有 goto 語法?"
10631055
10641056#: ../../faq/design.rst:602
1065- #, fuzzy
10661057msgid ""
10671058"In the 1970s people realized that unrestricted goto could lead to messy "
10681059"\" spaghetti\" code that was hard to understand and revise. In a high-level "
@@ -1074,30 +1065,30 @@ msgid ""
10741065msgstr ""
10751066"在 1970 年代,人們了解到沒有限制的 goto 會導致混亂、難以理解和修改的「義大利"
10761067"麵」程式碼 (\" spaghetti\" code)。在高階語言裡,這也是不需要的,因為有方法可以"
1077- "做邏輯分支(以 Python 來說,用 ``if`` 陳述式和 ``or``、``and`` 及 ``if-"
1078- "else`` 運算式)和迴圈(用 ``while`` 和 ``for`` 陳述式,可能會有 ``continue`` "
1079- "和 ``break``)。"
1068+ "做邏輯分支(以 Python 來說,用 :keyword:`if` 陳述式和 :keyword:`or`、:"
1069+ "keyword:`and` 及 :keyword:`if`/:keyword:`else` 運算式)和迴圈(用 :keyword:"
1070+ "`while` 和 :keyword:`for` 陳述式,可能會有 :keyword:`continue` 和 :keyword:"
1071+ "`break`)。"
10801072
10811073#: ../../faq/design.rst:609
1082- #, fuzzy
10831074msgid ""
10841075"One can also use exceptions to provide a\" structured goto\" that works even "
10851076"across function calls. Many feel that exceptions can conveniently emulate "
10861077"all reasonable uses of the ``go`` or ``goto`` constructs of C, Fortran, and "
10871078"other languages. For example::"
10881079msgstr ""
10891080"我們也可以用例外來做「結構化的 goto」,這甚至可以跨函式呼叫。很多人覺得例外可"
1090- "以方便地模擬在 C、Fortran 和其他語言裡各種合理使用的「go」和「 goto」 。例"
1081+ "以方便地模擬在 C、Fortran 和其他語言裡各種合理使用的 ``go`` 和 `` goto`` 。例"
10911082"如:\n"
10921083"\n"
10931084"::"
10941085
10951086#: ../../faq/design.rst:625
1096- #, fuzzy
10971087msgid ""
10981088"This doesn't allow you to jump into the middle of a loop, but that's usually "
10991089"considered an abuse of ``goto`` anyway. Use sparingly."
1100- msgstr "這依然不能讓你跳進迴圈內,這通常被認為是對 goto 的濫用。請小心使用。"
1090+ msgstr ""
1091+ "這依然不能讓你跳進迴圈內,這通常被認為是對 ``goto`` 的濫用。請小心使用。"
11011092
11021093#: ../../faq/design.rst:630
11031094msgid "Why can't raw strings (r-strings) end with a backslash?"
@@ -1148,14 +1139,13 @@ msgid "Why doesn't Python have a \"with\" statement for attribute assignments?"
11481139msgstr "為何 Python 沒有屬性賦值的 with 陳述式?"
11491140
11501141#: ../../faq/design.rst:658
1151- #, fuzzy
11521142msgid ""
11531143"Python has a :keyword:`with` statement that wraps the execution of a block, "
11541144"calling code on the entrance and exit from the block. Some languages have a "
11551145"construct that looks like this::"
11561146msgstr ""
1157- "Python 的 with 陳述式包裝了一區塊程式的執行,在進入和離開該區塊時執行程式碼。 "
1158- "一些語言會有像如下的結構:\n"
1147+ "Python 的:keyword:` with` 陳述式包裝了一區塊程式的執行,在進入和離開該區塊時 "
1148+ "執行程式碼。 一些語言會有像如下的結構:\n"
11591149"\n"
11601150"::"
11611151
@@ -1194,28 +1184,26 @@ msgstr ""
11941184"::"
11951185
11961186#: ../../faq/design.rst:685
1197- #, fuzzy
11981187msgid ""
11991188"The snippet assumes that ``a`` must have a member attribute called ``x``. "
12001189"However, there is nothing in Python that tells the interpreter this. What "
12011190"should happen if ``a`` is, let us say, an integer? If there is a global "
12021191"variable named ``x``, will it be used inside the :keyword:`with` block? As "
12031192"you see, the dynamic nature of Python makes such choices much harder."
12041193msgstr ""
1205- "這段程式碼假設「a」 有一個叫做「x」 的成員屬性。然後,Python裡並沒有任何跡象告 "
1206- "訴直譯器這件事 。在假設「a」是一個整數的話,那會發生什麼事?如果有一個全域變數 "
1207- "稱為「x」 ,那在這個 with 區塊會被使用嗎?如你所見,Python動態的天性使得這種 "
1208- "選擇更加困難 。"
1194+ "這段程式碼假設 ``a`` 有一個叫做 ``x`` 的成員屬性。然後,Python裡並沒有任何跡 "
1195+ "象告訴直譯器這件事 。在假設「a」是一個整數的話,那會發生什麼事?如果有一個全域 "
1196+ "變數稱為 ``x`` ,那在這個:keyword:` with` 區塊會被使用嗎?如你所見,Python動 "
1197+ "態的天性使得這種選擇更加困難 。"
12091198
12101199#: ../../faq/design.rst:691
1211- #, fuzzy
12121200msgid ""
12131201"The primary benefit of :keyword:`with` and similar language features "
12141202"(reduction of code volume) can, however, easily be achieved in Python by "
12151203"assignment. Instead of::"
12161204msgstr ""
1217- "然而, with 陳述式或類似的語言特性(減少程式碼量)的主要好處可以透過賦值來達 "
1218- "成 。相較於這樣寫:\n"
1205+ "然而 :keyword:` with` 陳述式或類似的語言特性(減少程式碼量)的主要好處可以透過 "
1206+ "賦值來達成 。相較於這樣寫:\n"
12191207"\n"
12201208"::"
12211209
@@ -1247,7 +1235,6 @@ msgid "Why don't generators support the with statement?"
12471235msgstr "為何產生器 (generator) 不支援 with 陳述式?"
12481236
12491237#: ../../faq/design.rst:717
1250- #, fuzzy
12511238msgid ""
12521239"For technical reasons, a generator used directly as a context manager would "
12531240"not work correctly. When, as is most common, a generator is used as an "
@@ -1257,7 +1244,8 @@ msgid ""
12571244msgstr ""
12581245"出於技術原因,把產生器直接用作情境 (context) 管理器會無法正常運作。因為通常來"
12591246"說,產生器是被當成疊代器 (iterator),到最後完成時不需要被手動關閉。但如果你需"
1260- "要的話,你可以在 with 陳述式裡用「contextlib.closing(generator)」來包裝他。"
1247+ "要的話,你可以在 :keyword:`with` 陳述式裡用 :func:`contextlib."
1248+ "closing(generator) <contextlib.closing>` 來包裝他。"
12611249
12621250#: ../../faq/design.rst:725
12631251msgid "Why are colons required for the if/while/def/class statements?"