Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9d97568

Browse files
sync with cpython e7bb98a1
1 parent3fba602 commit9d97568

20 files changed

+4755
-4684
lines changed

‎faq/design.po‎

Lines changed: 65 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ msgid ""
99
msgstr ""
1010
"Project-Id-Version:Python 3.13\n"
1111
"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"
1313
"PO-Revision-Date:2023-08-31 11:34+0800\n"
1414
"Last-Translator:Steven Hsu <hsuhaochun@gmail.com>\n"
1515
"Language-Team:Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
@@ -138,18 +138,17 @@ msgstr ""
138138

139139
#:../../faq/design.rst:65
140140
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."
148147
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 等很多受歡迎的語言有一樣的行為。"
153152

154153
#:../../faq/design.rst:72
155154
msgid""
@@ -250,11 +249,11 @@ msgid ""
250249
"``m_`` prefix, so this explicitness is still useful in those languages, too."
251250
msgstr""
252251
"第一,這樣可以更明顯表現出你在用方法 (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_``,所以這種明確性在那些語言也是很好用的。"
258257

259258
#:../../faq/design.rst:127
260259
msgid""
@@ -354,12 +353,12 @@ msgstr ""
354353
msgid""
355354
"(b) When I read code that says len(x) I *know* that it is asking for the "
356355
"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-
"implementingan interface or inheriting from a class that has a standard "
360-
"len(). Witnessthe confusion we occasionally have when a class that is not "
361-
"implementing amapping has a get() or keys() method, or something that isn't "
362-
"a file has awrite() 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."
363362
msgstr""
364363
"(二) 當我看到一段程式碼寫著 len(x),我\\ *知道*\\ 他要找某個東西的長度。這"
365364
"告訴了我兩件事:結果是一個整數、參數是某種容器。相對地,當我看到 x.len(),我"
@@ -420,9 +419,8 @@ msgstr ""
420419
msgid""
421420
"The second objection is typically cast as:\"I am really telling a sequence "
422421
"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 ::"
426424
msgstr""
427425
"第二個反對意見通常是:「我是在叫一個序列把它的成員用一個字串常數連接起來」。"
428426
"但很遺憾地,你並不是在這樣做。因為某種原因,把 :meth:`~str.split` 當成字串方"
@@ -546,8 +544,8 @@ msgstr ""
546544

547545
#:../../faq/design.rst:279
548546
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::"
551549
msgstr""
552550
"對於呼叫物件裡的方法,你可以利用內建用來找尋特定方法的函式 :func:`getattr` 來"
553551
"做進一步的簡化: ::"
@@ -820,10 +818,10 @@ msgstr ""
820818
msgid""
821819
"Lists, on the other hand, are more like arrays in other languages. They "
822820
"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-
"currentdirectory. Functions which operate on this output would generally "
826-
"not breakif 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."
827825
msgstr""
828826
"另一方面,串列更像是其他語言的陣列 (array)。他可以有不固定個同類別物件,且為"
829827
"逐項操作。舉例來說,:func:`os.listdir('.') <os.listdir>` 回傳當下目錄裡的檔"
@@ -962,8 +960,8 @@ msgstr ""
962960
msgid""
963961
"would raise a :exc:`KeyError` exception because the id of the ``[1, 2]`` "
964962
"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`."
967965
msgstr""
968966
"這將會導致 :exc:`KeyError` 例外,因為 ``[1, 2]`` 的 id 在第一行和第二行是不同"
969967
"的。換句話說,字典的鍵應該要用 ``==`` 來做比較,而不是用 :keyword:`is`。"
@@ -1062,16 +1060,16 @@ msgstr ""
10621060

10631061
#:../../faq/design.rst:534
10641062
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 ornot. If you fail to meet these restrictions dictionaries "
1069-
"and other hashbased 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."
10701068
msgstr""
10711069
"此外,不管物件是否在字典中,如果 ``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+
"為基底的結構會出現不正常的行為。"
10751073

10761074
#:../../faq/design.rst:539
10771075
msgid""
@@ -1136,17 +1134,16 @@ msgstr ""
11361134
msgid""
11371135
"Python 2.6 adds an :mod:`abc` module that lets you define Abstract Base "
11381136
"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`."
11431141
msgstr""
11441142
"Python 2.6 加入了 :mod:`abc` 模組,讓你可以定義抽象基底類別 (Abstract Base "
11451143
"Class, ABC)。你可以使用 :func:`isinstance` 和 :func:`issubclass` 來確認一個實"
11461144
"例或是類別是否實作了某個抽象基底類別。而 :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`。"
11501147

11511148
#:../../faq/design.rst:578
11521149
msgid""
@@ -1160,10 +1157,10 @@ msgid ""
11601157
"as a module interface specification and a set of examples. Many Python "
11611158
"modules can be run as a script to provide a simple\"self test.\" Even "
11621159
"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 canbe used to construct exhaustive test suites that exercise "
1166-
"every line of codein 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."
11671164
msgstr""
11681165
"一個針對模組的好測試套件提供了迴歸測試 (regression testing),並作為模組介面規"
11691166
"範和一組範例。許多 Python 模組可以直接當成腳本執行,並提供簡單的「自我測"
@@ -1172,13 +1169,14 @@ msgstr ""
11721169
"用來建構詳盡徹底的測試套件來測試模組裡的每一行程式碼。"
11731170

11741171
#:../../faq/design.rst:589
1172+
#,fuzzy
11751173
msgid""
11761174
"An appropriate testing discipline can help build large complex applications "
11771175
"in Python as well as having interface specifications would. In fact, it can "
11781176
"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 "
11801178
"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 "
11821180
"actually do this correctly, but it's trivial to check this property in a "
11831181
"test suite."
11841182
msgstr""
@@ -1210,16 +1208,16 @@ msgid ""
12101208
"\"spaghetti\" code that was hard to understand and revise. In a high-level "
12111209
"language, it is also unneeded as long as there are ways to branch (in "
12121210
"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`)."
12161214
msgstr""
12171215
"在 1970 年代,人們了解到沒有限制的 goto 會導致混亂、難以理解和修改的「義大利"
12181216
"麵」程式碼 (\"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`)。"
12231221

12241222
#:../../faq/design.rst:614
12251223
msgid""
@@ -1438,14 +1436,14 @@ msgstr "為何產生器 (generator) 不支援 with 陳述式?"
14381436
msgid""
14391437
"For technical reasons, a generator used directly as a context manager would "
14401438
"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."
14441442
msgstr""
14451443
"出於技術原因,把產生器直接用作情境 (context) 管理器會無法正常運作。因為通常來"
14461444
"說,產生器是被當成疊代器 (iterator),到最後完成時不需要被手動關閉。但如果你需"
1447-
"要的話,你可以在 :keyword:`with`陳述式裡"
1448-
"用 :func:`contextlib.closing(generator) <contextlib.closing>` 來包裝他。"
1445+
"要的話,你可以在 :keyword:`with`陳述式裡用 :func:`contextlib."
1446+
"closing(generator) <contextlib.closing>` 來包裝他。"
14491447

14501448
#:../../faq/design.rst:730
14511449
msgid"Why are colons required for the if/while/def/class statements?"

‎faq/programming.po‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ msgid ""
99
msgstr ""
1010
"Project-Id-Version:Python 3.13\n"
1111
"Report-Msgid-Bugs-To:\n"
12-
"POT-Creation-Date:2025-04-06 00:16+0000\n"
12+
"POT-Creation-Date:2025-09-06 00:15+0000\n"
1313
"PO-Revision-Date:2024-04-25 14:17+0800\n"
1414
"Last-Translator:KNChiu <y9760210@gmail.com>\n"
1515
"Language-Team:Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
@@ -894,10 +894,11 @@ msgid ""
894894
msgstr"list 是 :term:`mutable`,這意味著你可以變更它們的內容。"
895895

896896
#:../../faq/programming.rst:457
897+
#,fuzzy
897898
msgid""
898-
"After the call to :meth:`!append`, the content of the mutable object has "
899-
"changed from ``[]`` to ``[10]``. Since both the variables refer to the same "
900-
"object, using either name accesses the modified value ``[10]``."
899+
"After the call to :meth:`~sequence.append`, the content of the mutable "
900+
"object haschanged from ``[]`` to ``[10]``. Since both the variables refer "
901+
"to the sameobject, using either name accesses the modified value ``[10]``."
901902
msgstr""
902903
"在呼叫 :meth:`!append` 之後,可變物件的內容從 ``[]`` 變成了 ``[10]``。由於這"
903904
"兩個變數都參照同一個物件,因此使用任一名稱都可以存取修改後的值 ``[10]``。"
@@ -2829,8 +2830,9 @@ msgid ""
28292830
"an :meth:`~object.__iadd__` magic method, it gets called when the ``+=`` "
28302831
"augmented assignment is executed, and its return value is what gets used in "
28312832
"the assignment statement; and (b) for lists, :meth:`!__iadd__` is equivalent "
2832-
"to calling :meth:`!extend` on the list and returning the list. That's why "
2833-
"we say that for lists, ``+=`` is a\"shorthand\" for :meth:`!list.extend`::"
2833+
"to calling :meth:`~sequence.extend` on the list and returning the list. "
2834+
"That's why we say that for lists, ``+=`` is a\"shorthand\" for :meth:`list."
2835+
"extend`::"
28342836
msgstr""
28352837
"要了解為什麼會發生這種情況,你需要知道 (a) 如果一個物件實作了一個 :meth:"
28362838
"`~object.__iadd__` 魔術方法,它會在執行 ``+=`` 增廣賦值時被呼叫,並且它的回傳"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp