@@ -3044,6 +3044,14 @@ msgid ""
3044
3044
"mixed type comparisons which can call reflected the :meth:`~object.__gt__` "
3045
3045
"method."
3046
3046
msgstr ""
3047
+ "ソートアルゴリズムは、要素間の比較に ``<`` 演算子だけを使います。したがって"
3048
+ "ソートのためには :meth:`~object.__lt__` メソッドを定義すれば十分なはずです"
3049
+ "が、 :PEP:`8` は6つの :ref:`比較演算子 <comparisons>` を全て実装することを推"
3050
+ "奨しています。これにより、異なるメソッドを必要とする :func:`max` のような他の"
3051
+ "ソートツールを、同じデータに対して適用することによって起こりうるバグを避ける"
3052
+ "助けになります。6つの比較演算子を全て実装することは、リフレクションによって :"
3053
+ "meth:`~object.__gt__` メソッドを呼び出す可能性のある型混合の比較での混乱を避"
3054
+ "けることにも役立ちます。 "
3047
3055
3048
3056
#: ../../library/functions.rst:1668
3049
3057
msgid ""
@@ -3077,6 +3085,9 @@ msgid ""
3077
3085
"an instance (such as ``C().f()``). Moreover, they can be called as regular "
3078
3086
"functions (such as ``f()``)."
3079
3087
msgstr ""
3088
+ "静的メソッドは (``C.f()`` のように) クラスに対して呼び出すことも、 (``C()."
3089
+ "f()`` のように) インスタンスに対して呼び出すこともできます。さらに、 "
3090
+ "(``f()`` のように) 普通の関数として呼び出すこともできます。"
3080
3091
3081
3092
#: ../../library/functions.rst:1688
3082
3093
msgid ""
@@ -3112,6 +3123,10 @@ msgid ""
3112
3123
"``__name__``, ``__qualname__``, ``__doc__`` and ``__annotations__``), have a "
3113
3124
"new ``__wrapped__`` attribute, and are now callable as regular functions."
3114
3125
msgstr ""
3126
+ "静的メソッドはメソッド属性 (``__module__``, ``__name__``, ``__qualname__``, "
3127
+ "``__doc__`` そして ``__annotations__``) を継承するようになり、また新たに "
3128
+ "``__wrapped__`` 属性を持つようになりました。さらに、静的メソッドを通常の関数"
3129
+ "として呼び出すことができるようになりました。"
3115
3130
3116
3131
#: ../../library/functions.rst:1721
3117
3132
msgid ""
@@ -3172,13 +3187,18 @@ msgid ""
3172
3187
"The *object_or_type* determines the :term:`method resolution order` to be "
3173
3188
"searched. The search starts from the class right after the *type*."
3174
3189
msgstr ""
3190
+ "*object_or_type* はメソッドの検索のための :term:`method resolution order` (メ"
3191
+ "ソッド解決順序) を決定します。検索は *type* 直後のクラスから開始します。"
3175
3192
3176
3193
#: ../../library/functions.rst:1753
3177
3194
msgid ""
3178
3195
"For example, if :attr:`~class.__mro__` of *object_or_type* is ``D -> B -> C -"
3179
3196
"> A -> object`` and the value of *type* is ``B``, then :func:`super` "
3180
3197
"searches ``C -> A -> object``."
3181
3198
msgstr ""
3199
+ "例えば *object_or_type* の :attr:`~class.__mro__` 属性が ``D -> B -> C -> A -"
3200
+ "> object`` であり、 *type* の値が ``B`` だとすると、 :func:`super` は ``C -> "
3201
+ "A -> object`` の順番でメソッドを検索します。"
3182
3202
3183
3203
#: ../../library/functions.rst:1757
3184
3204
msgid ""
@@ -3227,6 +3247,14 @@ msgid ""
3227
3247
"changes in the class hierarchy, and because that order can include sibling "
3228
3248
"classes that are unknown prior to runtime)."
3229
3249
msgstr ""
3250
+ "2つ目の用途は動的な実行環境において協調的 (cooperative) な多重継承をサポート"
3251
+ "することです。これは Python に特有の用途で、静的にコンパイルされる言語や、単"
3252
+ "継承のみをサポートする言語には見られないものです。この機能により、同じ名前の"
3253
+ "メソッドを実装する複数の基底クラスを使った \" ダイヤモンド型* の継承構造を実装"
3254
+ "することができます。良い設計は、そのような実装において、どのような場合でも同"
3255
+ "じ呼び出しシグネチャを持つように強制します。 (理由は呼び出しの順序が実行時に"
3256
+ "決定されること、呼び出し順序はクラス階層構造の変化に順応すること、そして呼び"
3257
+ "出し順序が実行時まで未知の兄弟クラスが含まれる場合があることです)。"
3230
3258
3231
3259
#: ../../library/functions.rst:1782
3232
3260
msgid "For both use cases, a typical superclass call looks like this::"
@@ -3239,6 +3267,9 @@ msgid ""
3239
3267
"lookups. One possible use case for this is calling :term:`descriptors "
3240
3268
"<descriptor>` in a parent or sibling class."
3241
3269
msgstr ""
3270
+ "メソッドのルックアップに加えて、 :func:`super` は属性のルックアップに対しても"
3271
+ "同様に動作します。考えうる用途のひとつは親クラスや兄弟クラスの :term:"
3272
+ "`descriptors <descriptor>` (デスクリプタ) を呼び出すことです。"
3242
3273
3243
3274
#: ../../library/functions.rst:1793
3244
3275
msgid ""
@@ -3319,6 +3350,14 @@ msgid ""
3319
3350
"the :attr:`~object.__dict__` attribute. The following two statements create "
3320
3351
"identical :class:`type` objects:"
3321
3352
msgstr ""
3353
+ "引数が3つの場合、新しい型オブジェクトを返します。これは本質的には :keyword:"
3354
+ "`class` 文の動的な書式です。 *name* 文字列はクラス名で、 :attr:`~definition."
3355
+ "__name__` 属性になります。 *bases* 基底クラスのタプルで、 :attr:`~class."
3356
+ "__bases__` 属性になります; 空の場合は全てのクラスの基底クラスである :class:"
3357
+ "`object` が追加されます。 *dict* は、クラス本体の属性とメソッドの定義を含む辞"
3358
+ "書です; 辞書は :attr:`~object.__dict__` 属性になる前にコピーされたり、ラップ"
3359
+ "されることがあります。以下の2つの文は同じ :class:`type` オブジェクトを生成し"
3360
+ "ます:"
3322
3361
3323
3362
#: ../../library/functions.rst:1849
3324
3363
msgid "See also :ref:`bltin-type-objects`."
@@ -3331,6 +3370,9 @@ msgid ""
3331
3370
"in the same way that keywords in a class definition (besides *metaclass*) "
3332
3371
"would."
3333
3372
msgstr ""
3373
+ "三引数形式の呼び出しに与えられたキーワード引数は、(*metaclass* を除く) クラス"
3374
+ "定義におけるキーワード引数と同様に、適切なメタクラスの機構 (通常は :meth:"
3375
+ "`~object.__init_subclass__`) に渡されます。"
3334
3376
3335
3377
#: ../../library/functions.rst:1856
3336
3378
msgid "See also :ref:`class-customization`."
@@ -3382,12 +3424,17 @@ msgid ""
3382
3424
"doesn't have a :attr:`~object.__dict__` attribute (for example, if its class "
3383
3425
"defines the :attr:`~object.__slots__` attribute)."
3384
3426
msgstr ""
3427
+ "指定されたオブジェクトに :attr:`~object.__dict__` 属性がない場合 (たとえばそ"
3428
+ "のクラスが :attr:`~object.__slots__` 属性を定義している場合)、 :exc:"
3429
+ "`TypeError` 例外が送出されます。"
3385
3430
3386
3431
#: ../../library/functions.rst:1883
3387
3432
msgid ""
3388
3433
"Iterate over several iterables in parallel, producing tuples with an item "
3389
3434
"from each one."
3390
3435
msgstr ""
3436
+ "複数のイテラブルを並行に反復処理し、各イテラブルの要素からなるタプルを生成し"
3437
+ "ます。"
3391
3438
3392
3439
#: ../../library/functions.rst:1886
3393
3440
msgid "Example::"
@@ -3398,20 +3445,28 @@ msgid ""
3398
3445
"More formally: :func:`zip` returns an iterator of tuples, where the *i*-th "
3399
3446
"tuple contains the *i*-th element from each of the argument iterables."
3400
3447
msgstr ""
3448
+ "より正式な定義: :func:`zip` は、 *i* 番目のタプルが 引数に与えた各イテラブル"
3449
+ "の *i* 番目の要素を含むような、タプルのイテレータを返します。"
3401
3450
3402
3451
#: ../../library/functions.rst:1898
3403
3452
msgid ""
3404
3453
"Another way to think of :func:`zip` is that it turns rows into columns, and "
3405
3454
"columns into rows. This is similar to `transposing a matrix <https://en."
3406
3455
"wikipedia.org/wiki/Transpose>`_."
3407
3456
msgstr ""
3457
+ ":func:`zip` に対する別の考え方は、この関数は行を列に、また列を行に変換すると"
3458
+ "いうことです。これは `行列の転置 <https://en.wikipedia.org/wiki/Transpose>`_ "
3459
+ "とよく似ています。"
3408
3460
3409
3461
#: ../../library/functions.rst:1902
3410
3462
msgid ""
3411
3463
":func:`zip` is lazy: The elements won't be processed until the iterable is "
3412
3464
"iterated on, e.g. by a :keyword:`!for` loop or by wrapping in a :class:"
3413
3465
"`list`."
3414
3466
msgstr ""
3467
+ ":func:`zip` は遅延評価です: イテラブルが :keyword:`!for` ループに渡された"
3468
+ "り、 :class:`list` でラップされたりするなどして反復処理されるまで、要素が実際"
3469
+ "に処理されることはありません。"
3415
3470
3416
3471
#: ../../library/functions.rst:1906
3417
3472
msgid ""
0 commit comments