3
3
# This file is distributed under the same license as the Python package.
4
4
# FIRST AUTHOR <EMAIL@ADDRESS>, 2017.
5
5
#
6
- #, fuzzy
7
6
msgid ""
8
7
msgstr ""
9
8
"Project-Id-Version : Python 3.6\n "
@@ -18,23 +17,21 @@ msgstr ""
18
17
"Generated-By : Babel 2.17.0\n "
19
18
20
19
#: ../../library/numbers.rst:2
21
- #, fuzzy
22
20
msgid ":mod:`!numbers` --- Numeric abstract base classes"
23
- msgstr ":mod:`numbers` --- 숫자 추상 베이스 클래스"
21
+ msgstr ":mod:`! numbers` --- 숫자 추상 베이스 클래스"
24
22
25
23
#: ../../library/numbers.rst:7
26
24
msgid "**Source code:** :source:`Lib/numbers.py`"
27
25
msgstr "**소스 코드:** :source:`Lib/numbers.py`"
28
26
29
27
#: ../../library/numbers.rst:11
30
- #, fuzzy
31
28
msgid ""
32
29
"The :mod:`!numbers` module (:pep:`3141`) defines a hierarchy of numeric "
33
30
":term:`abstract base classes <abstract base class>` which progressively "
34
31
"define more operations. None of the types defined in this module are "
35
32
"intended to be instantiated."
36
33
msgstr ""
37
- ":mod:`numbers` 모듈(:pep:`3141`)은 숫자에 대한 :term:`추상 베이스 클래스 <abstract base "
34
+ ":mod:`! numbers` 모듈(:pep:`3141`)은 숫자에 대한 :term:`추상 베이스 클래스 <abstract base "
38
35
"class>` 의 계층 구조를 정의합니다. 계층 구조가 깊어질수록 더 많은 연산이 정의되어 있습니다. 이 모듈에 정의된 모든 형은 "
39
36
"인스턴스로 만들 수 없습니다."
40
37
@@ -52,7 +49,6 @@ msgid "The numeric tower"
52
49
msgstr "숫자 계층"
53
50
54
51
#: ../../library/numbers.rst:27
55
- #, fuzzy
56
52
msgid ""
57
53
"Subclasses of this type describe complex numbers and include the "
58
54
"operations that work on the built-in :class:`complex` type. These are: "
@@ -63,8 +59,8 @@ msgid ""
63
59
msgstr ""
64
60
"이 서브 클래스는 복소수를 표현하고 내장 :class:`complex` 형에 사용되는 연산을 포함합니다. 여기에는 "
65
61
":class:`complex` 와 :class:`bool` 형으로의 변환과 :attr:`.real`, :attr:`.imag`, "
66
- "``+``, ``-``, ``*``, ``/``, :func:`abs`, :meth:`conjugate`, ``==` `, "
67
- "``!=`` 이 포함됩니다. ``-`` 와 ``!=`` 를 제외하고는 모두 추상입니다. "
62
+ "``+``, ``-``, ``*``, ``/``, ``**``, :func:`abs`, :meth:`conjugate`, "
63
+ "``==``, `` !=`` 이 포함됩니다. ``-`` 와 ``!=`` 를 제외하고는 모두 추상입니다."
68
64
69
65
#: ../../library/numbers.rst:35
70
66
msgid "Abstract. Retrieves the real component of this number."
@@ -81,11 +77,10 @@ msgid ""
81
77
msgstr "추상 메서드. 켤레 복소수를 반환합니다. 예를 들어 ``(1+3j).conjugate() == (1-3j)`` 입니다."
82
78
83
79
#: ../../library/numbers.rst:49
84
- #, fuzzy
85
80
msgid ""
86
81
"To :class:`Complex`, :class:`!Real` adds the operations that work on real"
87
82
" numbers."
88
- msgstr ":class:`Real` 클래스는 :class:`Complex` 클래스에 실수 연산을 추가합니다."
83
+ msgstr ":class:`! Real` 클래스는 :class:`Complex` 클래스에 실수 연산을 추가합니다."
89
84
90
85
#: ../../library/numbers.rst:52
91
86
msgid ""
@@ -106,15 +101,14 @@ msgstr ""
106
101
":meth:`~Complex.conjugate` 를 위한 기본값을 제공합니다."
107
102
108
103
#: ../../library/numbers.rst:62
109
- #, fuzzy
110
104
msgid ""
111
105
"Subtypes :class:`Real` and adds :attr:`~Rational.numerator` and "
112
106
":attr:`~Rational.denominator` properties. It also provides a default for "
113
107
":func:`float`."
114
108
msgstr ""
115
109
":class:`Real` 의 하위 형이고 :attr:`~Rational.numerator` 와 "
116
- ":attr:`~Rational.denominator` 프로퍼티가 추가됩니다. 이 프로퍼티는 기약 분수의 값이어야 합니다. 또한 "
117
- ":func:`float` 함수를 위한 기본값으로 사용됩니다 ."
110
+ ":attr:`~Rational.denominator` 프로퍼티가 추가됩니다. 또한 :func:`float` 함수를 위한 기본값을 "
111
+ "제공합니다 ."
118
112
119
113
#: ../../library/numbers.rst:66
120
114
msgid ""
@@ -128,7 +122,6 @@ msgid "Abstract."
128
122
msgstr "프로퍼티(추상 메서드)"
129
123
130
124
#: ../../library/numbers.rst:81
131
- #, fuzzy
132
125
msgid ""
133
126
"Subtypes :class:`Rational` and adds a conversion to :class:`int`. "
134
127
"Provides defaults for :func:`float`, :attr:`~Rational.numerator`, and "
@@ -138,16 +131,14 @@ msgid ""
138
131
msgstr ""
139
132
":class:`Rational` 의 하위 형이고 :class:`int` 클래스로 변환 기능이 추가됩니다. :func:`float`,"
140
133
" :attr:`~Rational.numerator`, :attr:`~Rational.denominator` 를 위한 기본값을 "
141
- "제공합니다. ``**`` 를 위한 메서드와 비트 연산 ``<<``, ``>>``, ``&``, ``^``, ``|``, ``~`` "
142
- "를 추가합니다."
134
+ "제공합니다. 모듈러스가 있는 :func:`pow` \\ 를 위한 추상 메서드와 비트 연산 ``<<``, ``>>``, ``&``, "
135
+ "``^``, ``|``, ``~`` 를 추가합니다."
143
136
144
137
#: ../../library/numbers.rst:89
145
- #, fuzzy
146
138
msgid "Notes for type implementers"
147
- msgstr "형 구현을 위한 주의 사항"
139
+ msgstr "형 구현자를 위한 주의 사항"
148
140
149
141
#: ../../library/numbers.rst:91
150
- #, fuzzy
151
142
msgid ""
152
143
"Implementers should be careful to make equal numbers equal and hash them "
153
144
"to the same values. This may be subtle if there are two different "
@@ -172,6 +163,16 @@ msgid ""
172
163
" # simple fractions.\n"
173
164
" return hash((self.numerator, self.denominator))"
174
165
msgstr ""
166
+ "def __hash__(self):\n"
167
+ " if self.denominator == 1:\n"
168
+ " # 정수입니다.\n"
169
+ " return hash(self.numerator)\n"
170
+ " # 비싼 검사이지만, 확실히 맞습니다.\n"
171
+ " if self == float(self):\n"
172
+ " return hash(float(self))\n"
173
+ " else:\n"
174
+ " # 간단한 분수에서의 높은 충돌률을 피하기위해 튜플의 해시를 사용합니다.\n"
175
+ " return hash((self.numerator, self.denominator))"
175
176
176
177
#: ../../library/numbers.rst:110
177
178
msgid "Adding More Numeric ABCs"
@@ -191,13 +192,14 @@ msgid ""
191
192
"class MyFoo(Complex): ...\n"
192
193
"MyFoo.register(Real)"
193
194
msgstr ""
195
+ "class MyFoo(Complex): ...\n"
196
+ "MyFoo.register(Real)"
194
197
195
198
#: ../../library/numbers.rst:124
196
199
msgid "Implementing the arithmetic operations"
197
200
msgstr "산술 연산 구현"
198
201
199
202
#: ../../library/numbers.rst:126
200
- #, fuzzy
201
203
msgid ""
202
204
"We want to implement the arithmetic operations so that mixed-mode "
203
205
"operations either call an implementation whose author knew about the "
@@ -207,8 +209,9 @@ msgid ""
207
209
"defined as::"
208
210
msgstr ""
209
211
"다른 형에 대한 연산은 두 인자의 형에 관해 알고 있는 구현을 호출하거나 두 인자를 가장 비슷한 내장형으로 변환하여 연산하도록 산술"
210
- " 연산을 구현하는 것이 좋습니다. :class:`Integral` 클래스의 하위 형일 경우에 :meth:`__add__` 와 "
211
- ":meth:`__radd__` 메서드는 다음과 같이 정의되어야 함을 의미합니다::"
212
+ " 연산을 구현하는 것이 좋습니다. :class:`Integral` 클래스의 하위 형일 경우에 "
213
+ ":meth:`~object.__add__` 와 :meth:`~object.__radd__` 메서드는 다음과 같이 정의되어야 함을 "
214
+ "의미합니다::"
212
215
213
216
#: ../../library/numbers.rst:133
214
217
msgid ""
@@ -236,6 +239,29 @@ msgid ""
236
239
" else:\n"
237
240
" return NotImplemented"
238
241
msgstr ""
242
+ "class MyIntegral(Integral):\n"
243
+ "\n"
244
+ " def __add__(self, other):\n"
245
+ " if isinstance(other, MyIntegral):\n"
246
+ " return do_my_adding_stuff(self, other)\n"
247
+ " elif isinstance(other, OtherTypeIKnowAbout):\n"
248
+ " return do_my_other_adding_stuff(self, other)\n"
249
+ " else:\n"
250
+ " return NotImplemented\n"
251
+ "\n"
252
+ " def __radd__(self, other):\n"
253
+ " if isinstance(other, MyIntegral):\n"
254
+ " return do_my_adding_stuff(other, self)\n"
255
+ " elif isinstance(other, OtherTypeIKnowAbout):\n"
256
+ " return do_my_other_adding_stuff(other, self)\n"
257
+ " elif isinstance(other, Integral):\n"
258
+ " return int(other) + int(self)\n"
259
+ " elif isinstance(other, Real):\n"
260
+ " return float(other) + float(self)\n"
261
+ " elif isinstance(other, Complex):\n"
262
+ " return complex(other) + complex(self)\n"
263
+ " else:\n"
264
+ " return NotImplemented"
239
265
240
266
#: ../../library/numbers.rst:158
241
267
msgid ""
@@ -251,34 +277,31 @@ msgstr ""
251
277
"비슷하게 ``b : B <: Complex`` 입니다. ``a + b`` 인 경우를 생각해 보겠습니다:"
252
278
253
279
#: ../../library/numbers.rst:165
254
- #, fuzzy
255
280
msgid ""
256
281
"If ``A`` defines an :meth:`~object.__add__` which accepts ``b``, all is "
257
282
"well."
258
- msgstr "만약 ``A`` 가 ``b`` 를 받는 :meth:`__add__` 메서드를 정의했다면 모든 것이 문제없이 처리됩니다."
283
+ msgstr "만약 ``A`` 가 ``b`` 를 받는 :meth:`~object. __add__` 메서드를 정의했다면 모든 것이 문제없이 처리됩니다."
259
284
260
285
#: ../../library/numbers.rst:167
261
- #, fuzzy
262
286
msgid ""
263
287
"If ``A`` falls back to the boilerplate code, and it were to return a "
264
288
"value from :meth:`~object.__add__`, we'd miss the possibility that ``B`` "
265
289
"defines a more intelligent :meth:`~object.__radd__`, so the boilerplate "
266
290
"should return :data:`NotImplemented` from :meth:`!__add__`. (Or ``A`` may"
267
291
" not implement :meth:`!__add__` at all.)"
268
292
msgstr ""
269
- "``A`` 가 기본구조 코드로 진입하고 :meth:`__add__`\\ 로 부터 어떤 값을 반환한다면 ``B`` 가 똑똑하게 정의한 "
270
- ":meth:`__radd__` 메서드를 놓칠 수 있습니다. 이를 피하려면 기본구조는 :meth:`__add__` 에서 "
271
- ":const:` NotImplemented` 를 반환해야 합니다. (또는 ``A`` 가 :meth:`__add__` 메서드를 전혀 "
272
- "구현하지 않을 수도 있습니다.)"
293
+ "``A`` 가 기본구조 코드로 진입하고 :meth:`~object. __add__`\\ 로 부터 어떤 값을 반환한다면 ``B`` 가 "
294
+ "똑똑하게 정의한 :meth:`~object. __radd__` 메서드를 놓칠 수 있습니다. 이를 피하려면 기본구조는 "
295
+ ":meth:`!__add__` 에서 :data:` NotImplemented` 를 반환해야 합니다. (또는 ``A`` 가 "
296
+ ":meth:`!__add__` 메서드를 전혀 구현하지 않을 수도 있습니다.)"
273
297
274
298
#: ../../library/numbers.rst:173
275
- #, fuzzy
276
299
msgid ""
277
300
"Then ``B``'s :meth:`~object.__radd__` gets a chance. If it accepts ``a``,"
278
301
" all is well."
279
302
msgstr ""
280
- "그다음 ``B`` 의 :meth:`__radd__` 메서드가 기회를 얻습니다. 이 메서드가 ``a`` 를 받을 수 있다면 모든 것이 "
281
- " 문제없이 처리됩니다."
303
+ "그다음 ``B`` 의 :meth:`~object. __radd__` 메서드가 기회를 얻습니다. 이 메서드가 ``a`` 를 받을 수 "
304
+ "있다면 모든 것이 문제없이 처리됩니다."
282
305
283
306
#: ../../library/numbers.rst:175
284
307
msgid ""
@@ -297,16 +320,15 @@ msgstr ""
297
320
"이 인스턴스를 처리할 수 있습니다."
298
321
299
322
#: ../../library/numbers.rst:183
300
- #, fuzzy
301
323
msgid ""
302
324
"If ``A <: Complex`` and ``B <: Real`` without sharing any other "
303
325
"knowledge, then the appropriate shared operation is the one involving the"
304
326
" built in :class:`complex`, and both :meth:`~object.__radd__` s land "
305
327
"there, so ``a+b == b+a``."
306
328
msgstr ""
307
329
"만약 어떤 것도 공유하지 않는 ``A <: Complex`` 와 ``B <: Real`` 라면 적절한 공유 연산(shared "
308
- "operation)은 내장 :class:`complex` 클래스에 연관된 것입니다. 양쪽의 :meth:`__radd__` 메서드가 "
309
- "여기에 해당하므로 ``a+b == b+a`` 가 됩니다."
330
+ "operation)은 내장 :class:`complex` 클래스에 연관된 것입니다. 양쪽의 "
331
+ ":meth:`~object.__radd__` 메서드가 여기에 해당하므로 ``a+b == b+a`` 가 됩니다."
310
332
311
333
#: ../../library/numbers.rst:188
312
334
msgid ""
@@ -359,4 +381,41 @@ msgid ""
359
381
"\n"
360
382
"# ..."
361
383
msgstr ""
384
+ "def _operator_fallbacks(monomorphic_operator, fallback_operator):\n"
385
+ " def forward(a, b):\n"
386
+ " if isinstance(b, (int, Fraction)):\n"
387
+ " return monomorphic_operator(a, b)\n"
388
+ " elif isinstance(b, float):\n"
389
+ " return fallback_operator(float(a), b)\n"
390
+ " elif isinstance(b, complex):\n"
391
+ " return fallback_operator(complex(a), b)\n"
392
+ " else:\n"
393
+ " return NotImplemented\n"
394
+ " forward.__name__ = '__' + fallback_operator.__name__ + '__'\n"
395
+ " forward.__doc__ = monomorphic_operator.__doc__\n"
396
+ "\n"
397
+ " def reverse(b, a):\n"
398
+ " if isinstance(a, Rational):\n"
399
+ " # 정수를 포함합니다.\n"
400
+ " return monomorphic_operator(a, b)\n"
401
+ " elif isinstance(a, Real):\n"
402
+ " return fallback_operator(float(a), float(b))\n"
403
+ " elif isinstance(a, Complex):\n"
404
+ " return fallback_operator(complex(a), complex(b))\n"
405
+ " else:\n"
406
+ " return NotImplemented\n"
407
+ " reverse.__name__ = '__r' + fallback_operator.__name__ + '__'\n"
408
+ " reverse.__doc__ = monomorphic_operator.__doc__\n"
409
+ "\n"
410
+ " return forward, reverse\n"
411
+ "\n"
412
+ "def _add(a, b):\n"
413
+ " \"\"\" a + b\"\"\" \n"
414
+ " return Fraction(a.numerator * b.denominator +\n"
415
+ " b.numerator * a.denominator,\n"
416
+ " a.denominator * b.denominator)\n"
417
+ "\n"
418
+ "__add__, __radd__ = _operator_fallbacks(_add, operator.add)\n"
419
+ "\n"
420
+ "# ..."
362
421
0 commit comments