9
9
msgstr ""
10
10
"Project-Id-Version :Python 3.13\n "
11
11
"Report-Msgid-Bugs-To :\n "
12
- "POT-Creation-Date :2024 -09-24 07:20 +0000\n "
12
+ "POT-Creation-Date :2025 -09-06 00:15 +0000\n "
13
13
"PO-Revision-Date :2023-08-31 11:34+0800\n "
14
14
"Last-Translator :Steven Hsu <hsuhaochun@gmail.com>\n "
15
15
"Language-Team :Chinese - TAIWAN (https://github.com/python/python-docs-zh- "
@@ -138,18 +138,17 @@ msgstr ""
138
138
139
139
#: ../../faq/design.rst:65
140
140
msgid ""
141
- "The :class:`float` type in CPython uses a C ``double`` for storage. "
142
- "A :class:`float` object's value is stored in binary floating-point with a "
143
- "fixed precision (typically 53 bits) and Python uses C operations, which in "
144
- "turn rely on the hardware implementation in the processor, to perform "
145
- "floating-point operations. This means that as far as floating-point "
146
- "operations are concerned, Python behaves like many popular languages "
147
- "including C and Java."
141
+ "The :class:`float` type in CPython uses a C ``double`` for storage. A :"
142
+ "class:`float` object's value is stored in binary floating-point with a fixed "
143
+ "precision (typically 53 bits) and Python uses C operations, which in turn "
144
+ "rely on the hardware implementation in the processor, to perform floating-"
145
+ "point operations. This means that as far as floating-point operations are "
146
+ "concerned, Python behaves like many popular languages including C and Java."
148
147
msgstr ""
149
- "CPython 的 :class:`float` 型別使用了 C 的 ``double`` 型別來儲存。一 "
150
- "個 :class: `float` 物件的值會以固定的精度(通常為 53 位元)存為二進制浮點數,"
151
- "Python 使用 C 來運算浮點數,而他的結果會依處理器中的硬體實作方式來決定。這表 "
152
- "示就浮點數運算來說 ,Python 和 C、Java 等很多受歡迎的語言有一樣的行為。"
148
+ "CPython 的 :class:`float` 型別使用了 C 的 ``double`` 型別來儲存。一個 :class: "
149
+ "`float` 物件的值會以固定的精度(通常為 53 位元)存為二進制浮點數,Python 使 "
150
+ "用 C 來運算浮點數,而他的結果會依處理器中的硬體實作方式來決定。這表示就浮點數 "
151
+ "運算來說 ,Python 和 C、Java 等很多受歡迎的語言有一樣的行為。"
153
152
154
153
#: ../../faq/design.rst:72
155
154
msgid ""
@@ -250,11 +249,11 @@ msgid ""
250
249
"``m_`` prefix, so this explicitness is still useful in those languages, too."
251
250
msgstr ""
252
251
"第一,這樣可以更明顯表現出你在用方法 (method) 或是實例 (instance) 的屬性,而"
253
- "非一個區域變數。即使不知道類別 (class) 的定義,當看到 ``self.x`` 或 "
254
- "``self. meth()``,就會很清楚地知道是正在使用實例的變數或是方法。在 C++ 裡,你 "
255
- "可以藉由沒有區域變數宣告來判斷這件事 ── 但在 Python 裡沒有區域變數宣告,所以 "
256
- "你必須去看類別的定義來確定 。有些 C++ 和 Java的程式碼規格要求要在實例屬性的名 "
257
- "稱加上前綴 ``m_``,所以這種明確性在那些語言也是很好用的。"
252
+ "非一個區域變數。即使不知道類別 (class) 的定義,當看到 ``self.x`` 或``self. "
253
+ "meth()``,就會很清楚地知道是正在使用實例的變數或是方法。在 C++ 裡,你可以藉由 "
254
+ "沒有區域變數宣告來判斷這件事 ── 但在 Python 裡沒有區域變數宣告,所以你必須去 "
255
+ "看類別的定義來確定 。有些 C++ 和 Java的程式碼規格要求要在實例屬性的名稱加上前 "
256
+ "綴 ``m_``,所以這種明確性在那些語言也是很好用的。"
258
257
259
258
#: ../../faq/design.rst:127
260
259
msgid ""
@@ -354,12 +353,12 @@ msgstr ""
354
353
msgid ""
355
354
"(b) When I read code that says len(x) I *know* that it is asking for the "
356
355
"length of something. This tells me two things: the result is an integer, and "
357
- "the argument is some kind of container. To the contrary, when I read "
358
- "x. len(), I have to already know that x is some kind of container "
359
- "implementing an interface or inheriting from a class that has a standard "
360
- "len(). Witness the confusion we occasionally have when a class that is not "
361
- "implementing a mapping has a get() or keys() method, or something that isn't "
362
- "a file has a write() method."
356
+ "the argument is some kind of container. To the contrary, when I readx. "
357
+ "len(), I have to already know that x is some kind of container implementing "
358
+ "an interface or inheriting from a class that has a standard len(). Witness "
359
+ "the confusion we occasionally have when a class that is not implementing a "
360
+ "mapping has a get() or keys() method, or something that isn't a file has a "
361
+ "write() method."
363
362
msgstr ""
364
363
"(二) 當我看到一段程式碼寫著 len(x),我\\ *知道*\\ 他要找某個東西的長度。這"
365
364
"告訴了我兩件事:結果是一個整數、參數是某種容器。相對地,當我看到 x.len(),我"
@@ -420,9 +419,8 @@ msgstr ""
420
419
msgid ""
421
420
"The second objection is typically cast as:\" I am really telling a sequence "
422
421
"to join its members together with a string constant\" . Sadly, you aren't. "
423
- "For some reason there seems to be much less difficulty with "
424
- "having :meth:`~str.split` as a string method, since in that case it is easy "
425
- "to see that ::"
422
+ "For some reason there seems to be much less difficulty with having :meth:"
423
+ "`~str.split` as a string method, since in that case it is easy to see that ::"
426
424
msgstr ""
427
425
"第二個反對意見通常是:「我是在叫一個序列把它的成員用一個字串常數連接起來」。"
428
426
"但很遺憾地,你並不是在這樣做。因為某種原因,把 :meth:`~str.split` 當成字串方"
@@ -546,8 +544,8 @@ msgstr ""
546
544
547
545
#: ../../faq/design.rst:279
548
546
msgid ""
549
- "For calling methods on objects, you can simplify yet further by using "
550
- "the : func:`getattr` built-in to retrieve methods with a particular name::"
547
+ "For calling methods on objects, you can simplify yet further by usingthe : "
548
+ "func:`getattr` built-in to retrieve methods with a particular name::"
551
549
msgstr ""
552
550
"對於呼叫物件裡的方法,你可以利用內建用來找尋特定方法的函式 :func:`getattr` 來"
553
551
"做進一步的簡化: ::"
@@ -820,10 +818,10 @@ msgstr ""
820
818
msgid ""
821
819
"Lists, on the other hand, are more like arrays in other languages. They "
822
820
"tend to hold a varying number of objects all of which have the same type and "
823
- "which are operated on one-by-one. For example, :func:`os.listdir('.') "
824
- "<os. listdir>` returns a list of strings representing the files in the "
825
- "current directory. Functions which operate on this output would generally "
826
- "not break if you added another file or two to the directory."
821
+ "which are operated on one-by-one. For example, :func:`os.listdir('.')<os. "
822
+ "listdir>` returns a list of strings representing the files in the current "
823
+ "directory. Functions which operate on this output would generally not break "
824
+ "if you added another file or two to the directory."
827
825
msgstr ""
828
826
"另一方面,串列更像是其他語言的陣列 (array)。他可以有不固定個同類別物件,且為"
829
827
"逐項操作。舉例來說,:func:`os.listdir('.') <os.listdir>` 回傳當下目錄裡的檔"
@@ -962,8 +960,8 @@ msgstr ""
962
960
msgid ""
963
961
"would raise a :exc:`KeyError` exception because the id of the ``[1, 2]`` "
964
962
"used in the second line differs from that in the first line. In other "
965
- "words, dictionary keys should be compared using ``==``, not "
966
- "using :keyword: `is`."
963
+ "words, dictionary keys should be compared using ``==``, notusing :keyword: "
964
+ "`is`."
967
965
msgstr ""
968
966
"這將會導致 :exc:`KeyError` 例外,因為 ``[1, 2]`` 的 id 在第一行和第二行是不同"
969
967
"的。換句話說,字典的鍵應該要用 ``==`` 來做比較,而不是用 :keyword:`is`。"
@@ -1062,16 +1060,16 @@ msgstr ""
1062
1060
1063
1061
#: ../../faq/design.rst:534
1064
1062
msgid ""
1065
- "Furthermore it must always be the case that if ``o1 == o2`` (ie "
1066
- "``o1. __eq__(o2) is True``) then ``hash(o1) == hash(o2)`` (ie, "
1067
- "``o1.__hash__() == o2.__hash__()``), regardless of whether the object is in "
1068
- "a dictionary or not. If you fail to meet these restrictions dictionaries "
1069
- "and other hash based structures will misbehave."
1063
+ "Furthermore it must always be the case that if ``o1 == o2`` (ie``o1. "
1064
+ "__eq__(o2) is True``) then ``hash(o1) == hash(o2)`` (ie, ``o1.__hash__() == "
1065
+ "o2.__hash__()``), regardless of whether the object is in a dictionary or "
1066
+ "not. If you fail to meet these restrictions dictionaries and other hash "
1067
+ "based structures will misbehave."
1070
1068
msgstr ""
1071
1069
"此外,不管物件是否在字典中,如果 ``o1 == o2``\\ (即 ``o1.__eq__(o2) is "
1072
- "True``),則 ``hash(o1) == hash(o2)``\\ (即 ``o1.__hash__() == "
1073
- "o2. __hash__()``),這個事實必須要成立。如果無法滿足這項限制,那字典和其他用雜 "
1074
- "湊為基底的結構會出現不正常的行為 。"
1070
+ "True``),則 ``hash(o1) == hash(o2)``\\ (即 ``o1.__hash__() ==o2. "
1071
+ "__hash__()``),這個事實必須要成立。如果無法滿足這項限制,那字典和其他用雜湊 "
1072
+ "為基底的結構會出現不正常的行為 。"
1075
1073
1076
1074
#: ../../faq/design.rst:539
1077
1075
msgid ""
@@ -1136,17 +1134,16 @@ msgstr ""
1136
1134
msgid ""
1137
1135
"Python 2.6 adds an :mod:`abc` module that lets you define Abstract Base "
1138
1136
"Classes (ABCs). You can then use :func:`isinstance` and :func:`issubclass` "
1139
- "to check whether an instance or a class implements a particular ABC. "
1140
- "The : mod:`collections.abc` module defines a set of useful ABCs such "
1141
- "as :class: `~collections.abc.Iterable`, :class:`~collections.abc.Container`, "
1142
- "and :class: `~collections.abc.MutableMapping`."
1137
+ "to check whether an instance or a class implements a particular ABC.The : "
1138
+ "mod:`collections.abc` module defines a set of useful ABCs suchas :class: "
1139
+ "`~collections.abc.Iterable`, :class:`~collections.abc.Container`,and :class: "
1140
+ "`~collections.abc.MutableMapping`."
1143
1141
msgstr ""
1144
1142
"Python 2.6 加入了 :mod:`abc` 模組,讓你可以定義抽象基底類別 (Abstract Base "
1145
1143
"Class, ABC)。你可以使用 :func:`isinstance` 和 :func:`issubclass` 來確認一個實"
1146
1144
"例或是類別是否實作了某個抽象基底類別。而 :mod:`collections.abc` 模組定義了一"
1147
- "系列好用的抽象基底類別,像"
1148
- "是 :class:`~collections.abc.Iterable`、:class:`~collections.abc.Container` "
1149
- "和 :class:`~collections.abc.MutableMapping`。"
1145
+ "系列好用的抽象基底類別,像是 :class:`~collections.abc.Iterable`、:class:"
1146
+ "`~collections.abc.Container` 和 :class:`~collections.abc.MutableMapping`。"
1150
1147
1151
1148
#: ../../faq/design.rst:578
1152
1149
msgid ""
@@ -1160,10 +1157,10 @@ msgid ""
1160
1157
"as a module interface specification and a set of examples. Many Python "
1161
1158
"modules can be run as a script to provide a simple\" self test.\" Even "
1162
1159
"modules which use complex external interfaces can often be tested in "
1163
- "isolation using trivial\" stub\" emulations of the external interface. "
1164
- "The : mod:`doctest` and :mod:`unittest` modules or third-party test "
1165
- "frameworks can be used to construct exhaustive test suites that exercise "
1166
- "every line of code in a module."
1160
+ "isolation using trivial\" stub\" emulations of the external interface.The : "
1161
+ "mod:`doctest` and :mod:`unittest` modules or third-party test frameworks can "
1162
+ "be used to construct exhaustive test suites that exercise every line of code "
1163
+ "in a module."
1167
1164
msgstr ""
1168
1165
"一個針對模組的好測試套件提供了迴歸測試 (regression testing),並作為模組介面規"
1169
1166
"範和一組範例。許多 Python 模組可以直接當成腳本執行,並提供簡單的「自我測"
@@ -1172,13 +1169,14 @@ msgstr ""
1172
1169
"用來建構詳盡徹底的測試套件來測試模組裡的每一行程式碼。"
1173
1170
1174
1171
#: ../../faq/design.rst:589
1172
+ #, fuzzy
1175
1173
msgid ""
1176
1174
"An appropriate testing discipline can help build large complex applications "
1177
1175
"in Python as well as having interface specifications would. In fact, it can "
1178
1176
"be better because an interface specification cannot test certain properties "
1179
- "of a program. For example, the :meth:`! list.append` method is expected to "
1177
+ "of a program. For example, the :meth:`list.append` method is expected to "
1180
1178
"add new elements to the end of some internal list; an interface "
1181
- "specification cannot test that your :meth:`! list.append` implementation will "
1179
+ "specification cannot test that your :meth:`list.append` implementation will "
1182
1180
"actually do this correctly, but it's trivial to check this property in a "
1183
1181
"test suite."
1184
1182
msgstr ""
@@ -1210,16 +1208,16 @@ msgid ""
1210
1208
"\" spaghetti\" code that was hard to understand and revise. In a high-level "
1211
1209
"language, it is also unneeded as long as there are ways to branch (in "
1212
1210
"Python, with :keyword:`if` statements and :keyword:`or`, :keyword:`and`, "
1213
- "and :keyword:`if`/:keyword:`else` expressions) and loop "
1214
- "(with :keyword: `while` and :keyword:`for` statements, possibly "
1215
- "containing :keyword: `continue` and :keyword:`break`)."
1211
+ "and :keyword:`if`/:keyword:`else` expressions) and loop(with :keyword: "
1212
+ "`while` and :keyword:`for` statements, possiblycontaining :keyword: "
1213
+ "`continue` and :keyword:`break`)."
1216
1214
msgstr ""
1217
1215
"在 1970 年代,人們了解到沒有限制的 goto 會導致混亂、難以理解和修改的「義大利"
1218
1216
"麵」程式碼 (\" spaghetti\" code)。在高階語言裡,這也是不需要的,因為有方法可以"
1219
- "做邏輯分支(以 Python 來說,用 :keyword:`if`陳述式 "
1220
- "和 : keyword:`or`、:keyword:` and` 及 :keyword:`if`/:keyword:`else` 運算式)和 "
1221
- "迴圈(用 :keyword: `while` 和 :keyword:`for` 陳述式,可能會 "
1222
- "有 :keyword:`continue` 和 :keyword: `break`)。"
1217
+ "做邏輯分支(以 Python 來說,用 :keyword:`if`陳述式和 :keyword:`or`、: "
1218
+ "keyword:`and` 及 :keyword:`if`/:keyword:`else` 運算式)和迴圈(用 :keyword: "
1219
+ "`while` 和 :keyword:`for` 陳述式,可能會有 :keyword:`continue` 和 :keyword: "
1220
+ "`break`)。"
1223
1221
1224
1222
#: ../../faq/design.rst:614
1225
1223
msgid ""
@@ -1438,14 +1436,14 @@ msgstr "為何產生器 (generator) 不支援 with 陳述式?"
1438
1436
msgid ""
1439
1437
"For technical reasons, a generator used directly as a context manager would "
1440
1438
"not work correctly. When, as is most common, a generator is used as an "
1441
- "iterator run to completion, no closing is needed. When it is, wrap it "
1442
- "as : func:`contextlib.closing(generator) <contextlib.closing>` in "
1443
- "the :keyword: `with` statement."
1439
+ "iterator run to completion, no closing is needed. When it is, wrap itas : "
1440
+ "func:`contextlib.closing(generator) <contextlib.closing>` inthe :keyword: "
1441
+ "`with` statement."
1444
1442
msgstr ""
1445
1443
"出於技術原因,把產生器直接用作情境 (context) 管理器會無法正常運作。因為通常來"
1446
1444
"說,產生器是被當成疊代器 (iterator),到最後完成時不需要被手動關閉。但如果你需"
1447
- "要的話,你可以在 :keyword:`with`陳述式裡 "
1448
- "用 :func:`contextlib. closing(generator) <contextlib.closing>` 來包裝他。"
1445
+ "要的話,你可以在 :keyword:`with`陳述式裡用 :func:`contextlib. "
1446
+ "closing(generator) <contextlib.closing>` 來包裝他。"
1449
1447
1450
1448
#: ../../faq/design.rst:730
1451
1449
msgid "Why are colons required for the if/while/def/class statements?"