3
3
# This file is distributed under the same license as the Python package.
4
4
#
5
5
# Translators:
6
+ # Liang-Bo Wang <[email protected] >, 2016
7
+ # Matt Wang <[email protected] >, 2022
6
8
msgid ""
7
9
msgstr ""
8
10
"Project-Id-Version : Python 3.11\n "
9
11
"Report-Msgid-Bugs-To : \n "
10
- "POT-Creation-Date : 2022-09-05 00:20+0000 \n "
11
- "PO-Revision-Date : 2016 -11-19 00:32+0000 \n "
12
- "
Last-Translator :
Liang-Bo Wang <[email protected] >\n"
12
+ "POT-Creation-Date : 2022-10-16 04:24+0800 \n "
13
+ "PO-Revision-Date : 2022 -11-16 04:57+0800 \n "
14
+ "
Last-Translator :
Matt Wang <[email protected] >\n"
13
15
"Language-Team : Chinese - TAIWAN (https://github.com/python/python-docs-zh- "
14
16
"tw)\n "
15
17
"Language : zh_TW\n "
16
18
"MIME-Version : 1.0\n "
17
19
"Content-Type : text/plain; charset=UTF-8\n "
18
20
"Content-Transfer-Encoding : 8bit\n "
19
21
"Plural-Forms : nplurals=1; plural=0;\n "
22
+ "X-Generator : Poedit 3.2\n "
20
23
21
24
#: ../../library/numbers.rst:2
22
25
msgid ":mod:`numbers` --- Numeric abstract base classes"
23
- msgstr ""
26
+ msgstr ":mod:`numbers` --- 數值的抽象基底類別 "
24
27
25
28
#: ../../library/numbers.rst:7
26
29
msgid "**Source code:** :source:`Lib/numbers.py`"
@@ -33,16 +36,21 @@ msgid ""
33
36
"more operations. None of the types defined in this module are intended to "
34
37
"be instantiated."
35
38
msgstr ""
39
+ ":mod:`numbers` 模組 (:pep:`3141`) 定義了數值\\ :term:`抽象基底類別 <abstract "
40
+ "base class>` 的階層結構,其中逐一定義了更多操作。此模組中定義的型別都不可被實"
41
+ "例化。"
36
42
37
43
#: ../../library/numbers.rst:18
38
44
msgid ""
39
45
"The root of the numeric hierarchy. If you just want to check if an argument "
40
46
"*x* is a number, without caring what kind, use ``isinstance(x, Number)``."
41
47
msgstr ""
48
+ "數值階層結構的基礎。如果你只想確認引數 *x* 是不是數值、並不關心其型別,請使"
49
+ "用 ``isinstance(x, Number)``。"
42
50
43
51
#: ../../library/numbers.rst:23
44
52
msgid "The numeric tower"
45
- msgstr ""
53
+ msgstr "數值的階層 "
46
54
47
55
#: ../../library/numbers.rst:27
48
56
msgid ""
@@ -52,57 +60,70 @@ msgid ""
52
60
"``, ``*``, ``/``, ``**``, :func:`abs`, :meth:`conjugate`, ``==``, and ``!"
53
61
"=``. All except ``-`` and ``!=`` are abstract."
54
62
msgstr ""
63
+ "這個型別的子類別描述了複數並包含適用於內建 :class:`complex` 型別的操作。這些"
64
+ "操作有::class:`complex` 和 :class:`bool` 的轉換、:attr:`.real`、:attr:`."
65
+ "imag`、``+``、``-``、``*``、``/``、``**``、:func:`abs`、:meth:`conjugate`、"
66
+ "``==`` 以及 ``!=``。除 ``-`` 和 ``!=`` 之外所有操作都是抽象的。"
55
67
56
68
#: ../../library/numbers.rst:35
57
69
msgid "Abstract. Retrieves the real component of this number."
58
- msgstr ""
70
+ msgstr "為抽象的。取得該數值的實數部分。 "
59
71
60
72
#: ../../library/numbers.rst:39
61
73
msgid "Abstract. Retrieves the imaginary component of this number."
62
- msgstr ""
74
+ msgstr "為抽象的。取得該數值的虛數部分。 "
63
75
64
76
#: ../../library/numbers.rst:43
65
77
msgid ""
66
78
"Abstract. Returns the complex conjugate. For example, ``(1+3j).conjugate() "
67
79
"== (1-3j)``."
68
- msgstr ""
80
+ msgstr "為抽象的。回傳共軛複數,例如 ``(1+3j).conjugate() == (1-3j)``。 "
69
81
70
82
#: ../../library/numbers.rst:48
71
83
msgid ""
72
84
"To :class:`Complex`, :class:`Real` adds the operations that work on real "
73
85
"numbers."
74
- msgstr ""
86
+ msgstr "相對於 :class:`Complex`,:class:`Real` 加入了只有實數才能進行的操作。 "
75
87
76
88
#: ../../library/numbers.rst:51
77
89
msgid ""
78
90
"In short, those are: a conversion to :class:`float`, :func:`math.trunc`, :"
79
91
"func:`round`, :func:`math.floor`, :func:`math.ceil`, :func:`divmod`, ``//``, "
80
92
"``%``, ``<``, ``<=``, ``>``, and ``>=``."
81
93
msgstr ""
94
+ "簡單的說,有 :class:`float` 的轉換、:func:`math.trunc`、:func:`round`、:func:"
95
+ "`math.floor`、:func:`math.ceil`、:func:`divmod`、``//``、``%``、 ``<``、"
96
+ "``<=``、``>``、和 ``>=``。"
82
97
83
98
#: ../../library/numbers.rst:55
84
99
msgid ""
85
100
"Real also provides defaults for :func:`complex`, :attr:`~Complex.real`, :"
86
101
"attr:`~Complex.imag`, and :meth:`~Complex.conjugate`."
87
102
msgstr ""
103
+ "實數同樣提供 :func:`complex`、:attr:`~Complex.real`、:attr:`~Complex.imag` "
104
+ "和 :meth:`~Complex.conjugate` 的預設值。"
88
105
89
106
#: ../../library/numbers.rst:61
90
107
msgid ""
91
108
"Subtypes :class:`Real` and adds :attr:`~Rational.numerator` and :attr:"
92
109
"`~Rational.denominator` properties. It also provides a default for :func:"
93
110
"`float`."
94
111
msgstr ""
112
+ ":class:`Real` 的子型別,再加入 :attr:`~Rational.numerator` 和 :attr:"
113
+ "`~Rational.denominator` 這兩種特性。它也會提供 :func:`float` 的預設值。"
95
114
96
115
#: ../../library/numbers.rst:65
97
116
msgid ""
98
117
"The :attr:`~Rational.numerator` and :attr:`~Rational.denominator` values "
99
118
"should be instances of :class:`Integral` and should be in lowest terms with :"
100
119
"attr:`~Rational.denominator` positive."
101
120
msgstr ""
121
+ ":attr:`~Rational.numerator` 和 :attr:`~Rational.denominator` 的值必須是 :"
122
+ "class:`Integral` 的實例且 :attr:`~Rational.denominator` 要是正數。"
102
123
103
124
#: ../../library/numbers.rst:71 ../../library/numbers.rst:75
104
125
msgid "Abstract."
105
- msgstr ""
126
+ msgstr "為抽象的。 "
106
127
107
128
#: ../../library/numbers.rst:80
108
129
msgid ""
@@ -111,10 +132,14 @@ msgid ""
111
132
"`~Rational.denominator`. Adds abstract methods for :func:`pow` with modulus "
112
133
"and bit-string operations: ``<<``, ``>>``, ``&``, ``^``, ``|``, ``~``."
113
134
msgstr ""
135
+ ":class:`Rational` 的子型別,並增加了 :class:`int` 的轉換操作。為 :func:"
136
+ "`float`、:attr:`~Rational.numerator` 和 :attr:`~Rational.denominator` 提供了"
137
+ "預設值。為 :func:`pow` 方法增加了求餘 (modulus) 和位元字串運算 (bit-string "
138
+ "operations) 的抽象方法:``<<``、``>>``、``&``、``^``、``|``、``~``。"
114
139
115
140
#: ../../library/numbers.rst:88
116
141
msgid "Notes for type implementors"
117
- msgstr ""
142
+ msgstr "給型別實作者的註記 "
118
143
119
144
#: ../../library/numbers.rst:90
120
145
msgid ""
@@ -123,21 +148,30 @@ msgid ""
123
148
"the real numbers. For example, :class:`fractions.Fraction` implements :func:"
124
149
"`hash` as follows::"
125
150
msgstr ""
151
+ "實作者需注意,相等的數值除了大小相等外,還必須擁有同樣的雜湊值。當使用兩個不"
152
+ "同的實數擴充時,這可能是很微妙的。例如,:class:`fractions.Fraction` 底下的 :"
153
+ "func:`hash` 實作如下:\n"
154
+ "\n"
155
+ "::"
126
156
127
157
#: ../../library/numbers.rst:109
128
158
msgid "Adding More Numeric ABCs"
129
- msgstr ""
159
+ msgstr "加入更多數值 ABC "
130
160
131
161
#: ../../library/numbers.rst:111
132
162
msgid ""
133
163
"There are, of course, more possible ABCs for numbers, and this would be a "
134
164
"poor hierarchy if it precluded the possibility of adding those. You can add "
135
165
"``MyFoo`` between :class:`Complex` and :class:`Real` with::"
136
166
msgstr ""
167
+ "當然,還有更多用於數值的 ABC,如果不加入它們就不會有健全的階層。你可以在 :"
168
+ "class:`Complex` 和 :class:`Real` 中加入 ``MyFoo``,像是:\n"
169
+ "\n"
170
+ "::"
137
171
138
172
#: ../../library/numbers.rst:123
139
173
msgid "Implementing the arithmetic operations"
140
- msgstr ""
174
+ msgstr "實作算術操作 "
141
175
142
176
#: ../../library/numbers.rst:125
143
177
msgid ""
@@ -147,6 +181,12 @@ msgid ""
147
181
"there. For subtypes of :class:`Integral`, this means that :meth:`__add__` "
148
182
"and :meth:`__radd__` should be defined as::"
149
183
msgstr ""
184
+ "我們想要實作算術操作,來使得混合模式操作要麼呼叫一個作者知道兩個引數之型別的"
185
+ "實作,要麼將其轉換成最接近的內建型別並執行這個操作。對於 :class:"
186
+ "`Integral` 的子型別,這意味著 :meth:`__add__` 和 :meth:`__radd__` 必須用如下方式定"
187
+ "義:\n"
188
+ "\n"
189
+ "::"
150
190
151
191
#: ../../library/numbers.rst:156
152
192
msgid ""
@@ -156,10 +196,14 @@ msgid ""
156
196
"an instance of ``A``, which is a subtype of :class:`Complex` (``a : A <: "
157
197
"Complex``), and ``b : B <: Complex``. I'll consider ``a + b``:"
158
198
msgstr ""
199
+ ":class:`Complex` 的子類別有 5 種不同的混合型別操作。我將上面提到所有不涉及 "
200
+ "``MyIntegral`` 和 ``OtherTypeIKnowAbout`` 的程式碼稱作「模板 "
201
+ "(boilerplate)」。``a`` 是 :class:`Complex` 之子型別 ``A`` 的實例 (``a : A "
202
+ "<: Complex``),同時 ``b : B <: Complex``。我將要計算 ``a + b``:"
159
203
160
204
#: ../../library/numbers.rst:163
161
205
msgid "If ``A`` defines an :meth:`__add__` which accepts ``b``, all is well."
162
- msgstr ""
206
+ msgstr "如果 ``A`` 有定義成一個接受 ``b`` 的 :meth:`__add__`,不會發生問題。 "
163
207
164
208
#: ../../library/numbers.rst:165
165
209
msgid ""
@@ -169,32 +213,44 @@ msgid ""
169
213
"`NotImplemented` from :meth:`__add__`. (Or ``A`` may not implement :meth:"
170
214
"`__add__` at all.)"
171
215
msgstr ""
216
+ "如果 ``A`` 回退成模板程式碼,它將回傳一個來自 :meth:`__add__` 的值,並喪失讓 "
217
+ "``B`` 定義一個更完善的 :meth:`__radd__` 的機會,因此模板需要回傳一個來自 :"
218
+ "meth:`__add__` 的 :const:`NotImplemented`。(或者 ``A`` 可能完全不實作 :meth:"
219
+ "`__add__`。)"
172
220
173
221
#: ../../library/numbers.rst:171
174
222
msgid ""
175
223
"Then ``B``'s :meth:`__radd__` gets a chance. If it accepts ``a``, all is "
176
224
"well."
177
- msgstr ""
225
+ msgstr "接著看 ``B`` 的 :meth:`__radd__`。如果它接受 ``a`` ,不會發生問題。 "
178
226
179
227
#: ../../library/numbers.rst:173
180
228
msgid ""
181
229
"If it falls back to the boilerplate, there are no more possible methods to "
182
230
"try, so this is where the default implementation should live."
183
231
msgstr ""
232
+ "如果沒有成功回退到模板,就沒有更多的方法可以去嘗試,因此這裡將使用預設的實"
233
+ "作。"
184
234
185
235
#: ../../library/numbers.rst:176
186
236
msgid ""
187
237
"If ``B <: A``, Python tries ``B.__radd__`` before ``A.__add__``. This is ok, "
188
238
"because it was implemented with knowledge of ``A``, so it can handle those "
189
239
"instances before delegating to :class:`Complex`."
190
240
msgstr ""
241
+ "如果 ``B <: A``,Python 會在 ``A.__add__`` 之前嘗試 ``B.__radd__``。這是可行"
242
+ "的,因為它是透過對 ``A`` 的理解而實作的,所以這可以在交給 :class:`Complex` 之"
243
+ "前處理好這些實例。"
191
244
192
245
#: ../../library/numbers.rst:181
193
246
msgid ""
194
247
"If ``A <: Complex`` and ``B <: Real`` without sharing any other knowledge, "
195
248
"then the appropriate shared operation is the one involving the built in :"
196
249
"class:`complex`, and both :meth:`__radd__` s land there, so ``a+b == b+a``."
197
250
msgstr ""
251
+ "如果 ``A <: Complex`` 和 ``B <: Real`` 且沒有共享任何其他型別上的理解,那麼適當共享操作會涉"
252
+ "及內建的 :class:`complex`,並且分別用到 :meth:`__radd__`,因此 ``a+b == b"
253
+ "+a``。"
198
254
199
255
#: ../../library/numbers.rst:186
200
256
msgid ""
@@ -203,3 +259,7 @@ msgid ""
203
259
"reverse instances of any given operator. For example, :class:`fractions."
204
260
"Fraction` uses::"
205
261
msgstr ""
262
+ "由於大部分對任意給定類型的操作都十分相似的,定義一個為任意給定運算子生成向前 (forward) 與向"
263
+ "後 (reverse) 實例的輔助函式可能會非常有用。例如,:class:`fractions.Fraction` 使用了:\n"
264
+ "\n"
265
+ "::"
0 commit comments