-
-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathdescriptor.po
595 lines (522 loc) · 28.2 KB
/
descriptor.po
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2001-2021, Python Software Foundation
# This file is distributed under the same license as the Python package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
# Translators:
# tomo, 2019
# Tetsuo Koyama <[email protected]>, 2020
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Python 3.7\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-01 16:02+0000\n"
"PO-Revision-Date: 2019-09-01 03:37+0000\n"
"Last-Translator: Tetsuo Koyama <[email protected]>, 2020\n"
"Language-Team: Japanese (https://www.transifex.com/python-doc/teams/5390/"
"ja/)\n"
"Language: ja\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#: ../../howto/descriptor.rst:3
msgid "Descriptor HowTo Guide"
msgstr "デスクリプタ HowTo ガイド"
#: ../../howto/descriptor.rst:0
msgid "Author"
msgstr "著者"
#: ../../howto/descriptor.rst:5
msgid "Raymond Hettinger"
msgstr "Raymond Hettinger"
#: ../../howto/descriptor.rst:0
msgid "Contact"
msgstr "問い合わせ先"
#: ../../howto/descriptor.rst:6
msgid "<python at rcn dot com>"
msgstr "<python at rcn dot com>"
#: ../../howto/descriptor.rst:8
msgid "Contents"
msgstr "内容"
#: ../../howto/descriptor.rst:11
msgid "Abstract"
msgstr "概要"
#: ../../howto/descriptor.rst:13
msgid ""
"Defines descriptors, summarizes the protocol, and shows how descriptors are "
"called. Examines a custom descriptor and several built-in Python "
"descriptors including functions, properties, static methods, and class "
"methods. Shows how each works by giving a pure Python equivalent and a "
"sample application."
msgstr ""
#: ../../howto/descriptor.rst:18
msgid ""
"Learning about descriptors not only provides access to a larger toolset, it "
"creates a deeper understanding of how Python works and an appreciation for "
"the elegance of its design."
msgstr ""
"デスクリプタについて学ぶことにより、新しいツールセットが使えるようになるだけ"
"でなく、Python の仕組みや、洗練された設計のアプリケーションについてのより深い"
"理解が得られます。"
#: ../../howto/descriptor.rst:24
msgid "Definition and Introduction"
msgstr "定義と導入"
#: ../../howto/descriptor.rst:26
msgid ""
"In general, a descriptor is an object attribute with \"binding behavior\", "
"one whose attribute access has been overridden by methods in the descriptor "
"protocol. Those methods are :meth:`__get__`, :meth:`__set__`, and :meth:"
"`__delete__`. If any of those methods are defined for an object, it is said "
"to be a descriptor."
msgstr ""
"一般に、デスクリプタは \"束縛動作 (binding behavior)\" をもつオブジェクト属性"
"で、その属性アクセスが、デスクリプタプロトコルのメソッドによってオーバーライ"
"ドされたものです。このメソッドは、 :meth:`__get__`, :meth:`__set__`, および :"
"meth:`__delete__` です。これらのメソッドのいずれかが、オブジェクトに定義され"
"ていれば、それはデスクリプタと呼ばれます。"
#: ../../howto/descriptor.rst:32
msgid ""
"The default behavior for attribute access is to get, set, or delete the "
"attribute from an object's dictionary. For instance, ``a.x`` has a lookup "
"chain starting with ``a.__dict__['x']``, then ``type(a).__dict__['x']``, and "
"continuing through the base classes of ``type(a)`` excluding metaclasses. If "
"the looked-up value is an object defining one of the descriptor methods, "
"then Python may override the default behavior and invoke the descriptor "
"method instead. Where this occurs in the precedence chain depends on which "
"descriptor methods were defined."
msgstr ""
"属性アクセスのデフォルトの振る舞いは、オブジェクトの辞書の属性の取得、設定、"
"削除です。例えば ``a.x`` は、まず ``a.__dict__['x']``、それから ``type(a)."
"__dict__['x']``、さらに ``type(a)`` のメタクラスを除く基底クラスへと続くとい"
"うように探索が連鎖します。見つかった値が、デスクリプタメソッドのいずれかを定"
"義しているオブジェクトなら、Python はそのデフォルトの振る舞いをオーバーライド"
"し、代わりにデスクリプタメソッドを呼び出します。これがどの連鎖順位で行われる"
"かは、どのデスクリプタメソッドが定義されているかに依ります。"
#: ../../howto/descriptor.rst:41
msgid ""
"Descriptors are a powerful, general purpose protocol. They are the "
"mechanism behind properties, methods, static methods, class methods, and :"
"func:`super()`. They are used throughout Python itself to implement the new "
"style classes introduced in version 2.2. Descriptors simplify the "
"underlying C-code and offer a flexible set of new tools for everyday Python "
"programs."
msgstr ""
"デスクリプタは、強力な、多目的のプロトコルです。これはプロパティ、メソッド、"
"静的メソッド、クラスメソッド、そして :func:`super()` の背後にある機構です。こ"
"れはバージョン 2.2 で導入された新スタイルクラスを実装するために、Python のい"
"たるところで使われています。デスクリプタは、基幹にある C コードを簡潔にし、毎"
"日の Python プログラムに、柔軟な新しいツール群を提供します。"
#: ../../howto/descriptor.rst:49
msgid "Descriptor Protocol"
msgstr "デスクリプタプロトコル"
#: ../../howto/descriptor.rst:51
msgid "``descr.__get__(self, obj, type=None) -> value``"
msgstr "``descr.__get__(self, obj, type=None) -> value``"
#: ../../howto/descriptor.rst:53
msgid "``descr.__set__(self, obj, value) -> None``"
msgstr "``descr.__set__(self, obj, value) -> None``"
#: ../../howto/descriptor.rst:55
msgid "``descr.__delete__(self, obj) -> None``"
msgstr "``descr.__delete__(self, obj) -> None``"
#: ../../howto/descriptor.rst:57
msgid ""
"That is all there is to it. Define any of these methods and an object is "
"considered a descriptor and can override default behavior upon being looked "
"up as an attribute."
msgstr ""
"これで全てです。これらのメソッドのいずれかを定義すれば、オブジェクトはデスク"
"リプタとみなされ、探索された際のデフォルトの振る舞いをオーバーライドできま"
"す。"
#: ../../howto/descriptor.rst:61
msgid ""
"If an object defines both :meth:`__get__` and :meth:`__set__`, it is "
"considered a data descriptor. Descriptors that only define :meth:`__get__` "
"are called non-data descriptors (they are typically used for methods but "
"other uses are possible)."
msgstr ""
"あるオブジェクトが :meth:`__get__` と :meth:`__set__` の両方を定義していた"
"ら、それはデータデスクリプタとみなされます。 :meth:`__get__` だけを定義してい"
"るデスクリプタは、非データデスクリプタと呼ばれます (これらは典型的にはメソッ"
"ドに使われますが、他の使い方も出来ます)。"
#: ../../howto/descriptor.rst:66
msgid ""
"Data and non-data descriptors differ in how overrides are calculated with "
"respect to entries in an instance's dictionary. If an instance's dictionary "
"has an entry with the same name as a data descriptor, the data descriptor "
"takes precedence. If an instance's dictionary has an entry with the same "
"name as a non-data descriptor, the dictionary entry takes precedence."
msgstr ""
"データデスクリプタと非データデスクリプタでは、オーバーライドがインスタンスの"
"辞書のエントリに関してどのように計算されるかが異なります。インスタンスの辞書"
"に、データデスクリプタと同名の項目があれば、データデスクリプタの方が優先され"
"ます。インスタンスの辞書に、非データデスクリプタと同名の項目があれば、辞書の"
"項目の方が優先されます。"
#: ../../howto/descriptor.rst:72
msgid ""
"To make a read-only data descriptor, define both :meth:`__get__` and :meth:"
"`__set__` with the :meth:`__set__` raising an :exc:`AttributeError` when "
"called. Defining the :meth:`__set__` method with an exception raising "
"placeholder is enough to make it a data descriptor."
msgstr ""
"読み出し専用のデータデスクリプタを作るには、 :meth:`__get__` と :meth:"
"`__set__` の両方を定義し、 :meth:`__set__` が呼び出されたときに :exc:"
"`AttributeError` が送出されるようにしてください。例外を送出する :meth:"
"`__set__` メソッドをプレースホルダとして定義すれば、データデスクリプタにする"
"のに十分です。"
#: ../../howto/descriptor.rst:79
msgid "Invoking Descriptors"
msgstr "デスクリプタの呼び出し"
#: ../../howto/descriptor.rst:81
msgid ""
"A descriptor can be called directly by its method name. For example, ``d."
"__get__(obj)``."
msgstr ""
"デスクリプタは、メソッド名で直接呼ぶことも出来ます。例えば、``d."
"__get__(obj)`` です。"
#: ../../howto/descriptor.rst:84
msgid ""
"Alternatively, it is more common for a descriptor to be invoked "
"automatically upon attribute access. For example, ``obj.d`` looks up ``d`` "
"in the dictionary of ``obj``. If ``d`` defines the method :meth:`__get__`, "
"then ``d.__get__(obj)`` is invoked according to the precedence rules listed "
"below."
msgstr ""
"または、一般的に、デスクリプタは属性アクセスから自動的に呼び出されます。例え"
"ば、 ``obj.d`` は ``obj`` の辞書から ``d`` を探索します。 ``d`` がメソッド :"
"meth:`__get__` を定義していたら、以下に列挙する優先順位に従って、 ``d."
"__get__(obj)`` が呼び出されます。"
#: ../../howto/descriptor.rst:89
msgid ""
"The details of invocation depend on whether ``obj`` is an object or a class."
msgstr "呼び出しの詳細は、``obj`` がオブジェクトかクラスかに依ります。"
#: ../../howto/descriptor.rst:91
msgid ""
"For objects, the machinery is in :meth:`object.__getattribute__` which "
"transforms ``b.x`` into ``type(b).__dict__['x'].__get__(b, type(b))``. The "
"implementation works through a precedence chain that gives data descriptors "
"priority over instance variables, instance variables priority over non-data "
"descriptors, and assigns lowest priority to :meth:`__getattr__` if provided. "
"The full C implementation can be found in :c:func:"
"`PyObject_GenericGetAttr()` in :source:`Objects/object.c`."
msgstr ""
"オブジェクトでは、その機構は ``b.x`` を ``type(b).__dict__['x'].__get__(b, "
"type(b))`` に変換する :meth:`object.__getattribute__` にあります。データデス"
"クリプタの優先度はインスタンス変数より高く、インスタンス変数の優先度は非デー"
"タデスクリプタより高く、(提供されていれば) :meth:`__getattr__` の優先度が最も"
"低いように実装されています。完全な C 実装は、 :source:`Objects/object.c` の :"
"c:func:`PyObject_GenericGetAttr()` で見つかります。"
#: ../../howto/descriptor.rst:99
msgid ""
"For classes, the machinery is in :meth:`type.__getattribute__` which "
"transforms ``B.x`` into ``B.__dict__['x'].__get__(None, B)``. In pure "
"Python, it looks like::"
msgstr ""
"クラスでは、その機構は ``B.x`` を ``B.__dict__['x'].__get__(None, B)`` に変換"
"する :meth:`type.__getattribute__` にあります。 pure Python では、このように"
"なります::"
#: ../../howto/descriptor.rst:110
msgid "The important points to remember are:"
msgstr "憶えておくべき重要な点は:"
#: ../../howto/descriptor.rst:112
msgid "descriptors are invoked by the :meth:`__getattribute__` method"
msgstr "デスクリプタは :meth:`__getattribute__` メソッドによって呼び出される"
#: ../../howto/descriptor.rst:113
msgid "overriding :meth:`__getattribute__` prevents automatic descriptor calls"
msgstr ""
":meth:`__getattribute__` をオーバーライドすると、自動的なデスクリプタの呼び出"
"しが行われなくなる"
#: ../../howto/descriptor.rst:114
msgid ""
":meth:`object.__getattribute__` and :meth:`type.__getattribute__` make "
"different calls to :meth:`__get__`."
msgstr ""
":meth:`object.__getattribute__` と :meth:`type.__getattribute__` では、 :"
"meth:`__get__` の呼び出しが異なる。"
#: ../../howto/descriptor.rst:116
msgid "data descriptors always override instance dictionaries."
msgstr "データデスクリプタは、必ずインスタンス辞書をオーバーライドする。"
#: ../../howto/descriptor.rst:117
msgid "non-data descriptors may be overridden by instance dictionaries."
msgstr ""
"非データデスクリプタは、インスタンス辞書にオーバーライドされることがある。"
#: ../../howto/descriptor.rst:119
msgid ""
"The object returned by ``super()`` also has a custom :meth:"
"`__getattribute__` method for invoking descriptors. The call ``super(B, "
"obj).m()`` searches ``obj.__class__.__mro__`` for the base class ``A`` "
"immediately following ``B`` and then returns ``A.__dict__['m'].__get__(obj, "
"B)``. If not a descriptor, ``m`` is returned unchanged. If not in the "
"dictionary, ``m`` reverts to a search using :meth:`object.__getattribute__`."
msgstr ""
"``super()`` が返したオブジェクトにはさらにデスクリプタを起動するカスタム :"
"meth:`__getattribute__` メソッドがあります。 ``super(B, obj).m()`` の呼び出し"
"は、 ``B`` に続き基底クラス ``A`` を見つけるために ``obj.__class__.__mro__`` "
"を探索し、 ``A.__dict__['m'].__get__(obj, B)`` を返します。デスクリプタではな"
"い場合、 ``m`` が変更されずに返されます。辞書になければ、 ``m`` は :meth:"
"`object.__getattribute__` を使用した探索に戻ります。"
#: ../../howto/descriptor.rst:126
msgid ""
"The implementation details are in :c:func:`super_getattro()` in :source:"
"`Objects/typeobject.c`. and a pure Python equivalent can be found in "
"`Guido's Tutorial`_."
msgstr ""
"実装の詳細は、 :source:`Objects/typeobject.c` の :c:func:`super_getattro()` "
"と、 `Guido's Tutorial`_ にある等価な pure Python 版を参照してください。"
#: ../../howto/descriptor.rst:132
msgid ""
"The details above show that the mechanism for descriptors is embedded in "
"the :meth:`__getattribute__()` methods for :class:`object`, :class:`type`, "
"and :func:`super`. Classes inherit this machinery when they derive from :"
"class:`object` or if they have a meta-class providing similar functionality. "
"Likewise, classes can turn-off descriptor invocation by overriding :meth:"
"`__getattribute__()`."
msgstr ""
"上述の詳細は、デスクリプタの機構が、 :meth:`__getattribute__()` メソッドに埋"
"めこまれ、 :class:`object`, :class:`type`, そして :func:`super` に使われてい"
"るということを表しています。クラスは、 :class:`object` から導出されたとき、ま"
"たは、同じような機能を提供するメタクラスをもつとき、この機構を継承します。同"
"様に、 :meth:`__getattribute__()` をオーバーライドすることで、デスクリプタの"
"呼び出しを無効にできます。"
#: ../../howto/descriptor.rst:141
msgid "Descriptor Example"
msgstr "デスクリプタの例"
#: ../../howto/descriptor.rst:143
msgid ""
"The following code creates a class whose objects are data descriptors which "
"print a message for each get or set. Overriding :meth:`__getattribute__` is "
"alternate approach that could do this for every attribute. However, this "
"descriptor is useful for monitoring just a few chosen attributes::"
msgstr ""
"以下のコードは、オブジェクトが取得と設定のたびにメッセージを表示するデータデ"
"スクリプタであるようなクラスを生成します。代わりに :meth:`__getattribute__` "
"をオーバーライドすると、全ての属性に対してこれができます。しかし、このデスク"
"リプタは、少数の選ばれた属性を監視するのに便利です::"
#: ../../howto/descriptor.rst:181
msgid ""
"The protocol is simple and offers exciting possibilities. Several use cases "
"are so common that they have been packaged into individual function calls. "
"Properties, bound methods, static methods, and class methods are all based "
"on the descriptor protocol."
msgstr ""
"このプロトコルは単純ですが、ワクワクする可能性も秘めています。ユースケースの"
"中には、あまりに一般的なので個別の関数の呼び出しにまとめられたものもありま"
"す。プロパティ、束縛のメソッド、静的メソッド、そしてクラスメソッドは、全てデ"
"スクリプタプロトコルに基づいています。"
#: ../../howto/descriptor.rst:188
msgid "Properties"
msgstr "プロパティ"
#: ../../howto/descriptor.rst:190
msgid ""
"Calling :func:`property` is a succinct way of building a data descriptor "
"that triggers function calls upon access to an attribute. Its signature is::"
msgstr ""
":func:`property` を呼び出すことで、属性へアクセスすると関数の呼び出しを引き起"
"こす、データデスクリプタを簡潔に組み立てられます。シグネチャはこうです::"
#: ../../howto/descriptor.rst:195
msgid ""
"The documentation shows a typical use to define a managed attribute ``x``::"
msgstr ""
"このドキュメントでは、管理された属性 ``x`` を定義する典型的な使用法を示しま"
"す::"
#: ../../howto/descriptor.rst:203
msgid ""
"To see how :func:`property` is implemented in terms of the descriptor "
"protocol, here is a pure Python equivalent::"
msgstr ""
"デスクリプタの見地から :func:`property` がどのように実装されているかを見るた"
"めに、等価な Python 版をここに挙げます::"
#: ../../howto/descriptor.rst:243
msgid ""
"The :func:`property` builtin helps whenever a user interface has granted "
"attribute access and then subsequent changes require the intervention of a "
"method."
msgstr ""
"組み込みの :func:`property` 関数は、ユーザインタフェースへの属性アクセスが与"
"えられ、続く変更がメソッドの介入を要求するときに役立ちます。"
#: ../../howto/descriptor.rst:247
msgid ""
"For instance, a spreadsheet class may grant access to a cell value through "
"``Cell('b10').value``. Subsequent improvements to the program require the "
"cell to be recalculated on every access; however, the programmer does not "
"want to affect existing client code accessing the attribute directly. The "
"solution is to wrap access to the value attribute in a property data "
"descriptor::"
msgstr ""
"例えば、スプレッドシートクラスが、``Cell('b10').value`` でセルの値を取得でき"
"るとします。続く改良により、プログラムがアクセスの度にセルの再計算をすること"
"を要求しました。しかしプログラマは、その属性に直接アクセスする既存のクライア"
"ントコードに影響を与えたくありません。この解決策は、property データデスクリプ"
"タ内に値属性へのアクセスをラップすることです::"
#: ../../howto/descriptor.rst:263
msgid "Functions and Methods"
msgstr "関数とメソッド"
#: ../../howto/descriptor.rst:265
msgid ""
"Python's object oriented features are built upon a function based "
"environment. Using non-data descriptors, the two are merged seamlessly."
msgstr ""
"Python のオブジェクト指向機能は、関数に基づく環境の上に構築されています。非"
"データデスクリプタを使って、この 2 つはシームレスに組み合わされています。"
#: ../../howto/descriptor.rst:268
msgid ""
"Class dictionaries store methods as functions. In a class definition, "
"methods are written using :keyword:`def` or :keyword:`lambda`, the usual "
"tools for creating functions. Methods only differ from regular functions in "
"that the first argument is reserved for the object instance. By Python "
"convention, the instance reference is called *self* but may be called *this* "
"or any other variable name."
msgstr ""
"クラス辞書は、メソッドを関数として保存します。クラス定義内で、メソッドは、関"
"数を使うのに便利なツール、 :keyword:`def` か :keyword:`lambda` を使って書かれ"
"ます。メソッドの標準の関数との唯一の違いは、第一引数がオブジェクトインスタン"
"スのために予約されていることです。 Python の慣習では、このインスタンスの参照"
"は *self* と呼ばれますが、 *this* その他の好きな変数名で呼び出せます。"
#: ../../howto/descriptor.rst:275
msgid ""
"To support method calls, functions include the :meth:`__get__` method for "
"binding methods during attribute access. This means that all functions are "
"non-data descriptors which return bound methods when they are invoked from "
"an object. In pure Python, it works like this::"
msgstr ""
#: ../../howto/descriptor.rst:288
msgid ""
"Running the interpreter shows how the function descriptor works in practice::"
msgstr ""
"インタプリタを起動すると、この関数デスクリプタが実際にどうはたらくかを見られ"
"ます::"
#: ../../howto/descriptor.rst:326
msgid "Static Methods and Class Methods"
msgstr "静的メソッドとクラスメソッド"
#: ../../howto/descriptor.rst:328
msgid ""
"Non-data descriptors provide a simple mechanism for variations on the usual "
"patterns of binding functions into methods."
msgstr ""
"非データデスクリプタは、関数をメソッドに束縛する、各種の一般的なパターンに、"
"単純な機構を提供します。"
#: ../../howto/descriptor.rst:331
msgid ""
"To recap, functions have a :meth:`__get__` method so that they can be "
"converted to a method when accessed as attributes. The non-data descriptor "
"transforms an ``obj.f(*args)`` call into ``f(obj, *args)``. Calling ``klass."
"f(*args)`` becomes ``f(*args)``."
msgstr ""
"まとめると、関数は :meth:`__get__` メソッドを持ち、属性としてアクセスされたと"
"き、メソッドに変換されます。この非データディスクリプタは、 ``obj.f(*args)`` "
"の呼び出しを ``f(obj, *args)`` に変換します。 ``klass.f(*args)`` を呼び出す"
"と ``f(*args)`` になります。"
#: ../../howto/descriptor.rst:336
msgid "This chart summarizes the binding and its two most useful variants:"
msgstr "このチャートは、束縛と、その 2 つの異なる便利な形をまとめています:"
#: ../../howto/descriptor.rst:339
msgid "Transformation"
msgstr "変換"
#: ../../howto/descriptor.rst:339
msgid "Called from an Object"
msgstr "オブジェクトから呼び出される"
#: ../../howto/descriptor.rst:339
msgid "Called from a Class"
msgstr "クラスから呼び出される"
#: ../../howto/descriptor.rst:342
msgid "function"
msgstr "function"
#: ../../howto/descriptor.rst:342
msgid "f(obj, \\*args)"
msgstr "f(obj, \\*args)"
#: ../../howto/descriptor.rst:342 ../../howto/descriptor.rst:344
msgid "f(\\*args)"
msgstr "f(\\*args)"
#: ../../howto/descriptor.rst:344
msgid "staticmethod"
msgstr "静的メソッド"
#: ../../howto/descriptor.rst:346
msgid "classmethod"
msgstr "クラスメソッド"
#: ../../howto/descriptor.rst:346
msgid "f(type(obj), \\*args)"
msgstr "f(type(obj), \\*args)"
#: ../../howto/descriptor.rst:346
msgid "f(klass, \\*args)"
msgstr "f(klass, \\*args)"
#: ../../howto/descriptor.rst:349
msgid ""
"Static methods return the underlying function without changes. Calling "
"either ``c.f`` or ``C.f`` is the equivalent of a direct lookup into ``object."
"__getattribute__(c, \"f\")`` or ``object.__getattribute__(C, \"f\")``. As a "
"result, the function becomes identically accessible from either an object or "
"a class."
msgstr ""
"静的メソッドは、下にある関数をそのまま返します。 ``c.f`` や ``C.f`` は、 "
"``object.__getattribute__(c, \"f\")`` や ``object.__getattribute__(C, "
"\"f\")`` を直接探索するのと同じです。結果として、関数はオブジェクトとクラスか"
"ら同じようにアクセスできます。"
#: ../../howto/descriptor.rst:355
msgid ""
"Good candidates for static methods are methods that do not reference the "
"``self`` variable."
msgstr ""
"静的メソッドにすると良いのは、 ``self`` 変数への参照を持たないメソッドです。"
#: ../../howto/descriptor.rst:358
msgid ""
"For instance, a statistics package may include a container class for "
"experimental data. The class provides normal methods for computing the "
"average, mean, median, and other descriptive statistics that depend on the "
"data. However, there may be useful functions which are conceptually related "
"but do not depend on the data. For instance, ``erf(x)`` is handy conversion "
"routine that comes up in statistical work but does not directly depend on a "
"particular dataset. It can be called either from an object or the class: "
"``s.erf(1.5) --> .9332`` or ``Sample.erf(1.5) --> .9332``."
msgstr ""
"例えば、統計パッケージに、実験データのコンテナがあるとします。そのクラスは、"
"平均、メジアン、その他の、データに依る記述統計を計算する標準メソッドを提供し"
"ます。しかし、概念上は関係があっても、データには依らないような便利な関数もあ"
"ります。例えば、 ``erf(x)`` は統計上の便利な変換ルーチンですが、特定のデータ"
"セットに直接には依存しません。これは、オブジェクトからでもクラスからでも呼び"
"出せます: ``s.erf(1.5) --> .9332`` または ``Sample.erf(1.5) --> .9332`` 。"
#: ../../howto/descriptor.rst:367
msgid ""
"Since staticmethods return the underlying function with no changes, the "
"example calls are unexciting::"
msgstr ""
"静的メソッドは下にある関数をそのまま返すので、呼び出しの例は面白くありませ"
"ん::"
#: ../../howto/descriptor.rst:380
msgid ""
"Using the non-data descriptor protocol, a pure Python version of :func:"
"`staticmethod` would look like this::"
msgstr ""
"非データデスクリプタプロトコルを使うと、pure Python 版の :func:"
"`staticmethod` は以下のようになります::"
#: ../../howto/descriptor.rst:392
msgid ""
"Unlike static methods, class methods prepend the class reference to the "
"argument list before calling the function. This format is the same for "
"whether the caller is an object or a class::"
msgstr ""
"静的メソッドとは違って、クラスメソッドは関数を呼び出す前にクラス参照を引数リ"
"ストの先頭に加えます。このフォーマットは、呼び出し元がオブジェクトでもクラス"
"でも同じです::"
#: ../../howto/descriptor.rst:407
msgid ""
"This behavior is useful whenever the function only needs to have a class "
"reference and does not care about any underlying data. One use for "
"classmethods is to create alternate class constructors. In Python 2.3, the "
"classmethod :func:`dict.fromkeys` creates a new dictionary from a list of "
"keys. The pure Python equivalent is::"
msgstr ""
"この振る舞いは、関数がクラス参照のみを必要とし、下にあるデータを考慮しないと"
"きに便利です。クラスメソッドの使い方の一つは、代わりのクラスコンストラクタを"
"作ることです。Python 2.3 では、クラスメソッド :func:`dict.fromkeys` は新しい"
"辞書をキーのリストから生成します。等価な pure Python 版は::"
#: ../../howto/descriptor.rst:423
msgid "Now a new dictionary of unique keys can be constructed like this::"
msgstr "これで一意なキーを持つ新しい辞書が以下のように構成できます::"
#: ../../howto/descriptor.rst:428
msgid ""
"Using the non-data descriptor protocol, a pure Python version of :func:"
"`classmethod` would look like this::"
msgstr ""
"非データデスクリプタプロトコルを使った、 :func:`classmethod` の pure Python "
"版はこのようになります::"