@@ -2988,6 +2988,14 @@ msgid ""
2988
2988
"mixed type comparisons which can call reflected the :meth:`~object.__gt__` "
2989
2989
"method."
2990
2990
msgstr ""
2991
+ "ソートアルゴリズムは、要素間の比較に ``<`` 演算子だけを使います。したがって"
2992
+ "ソートのためには :meth:`~object.__lt__` メソッドを定義すれば十分なはずです"
2993
+ "が、 :PEP:`8` は6つの :ref:`比較演算子 <comparisons>` を全て実装することを推"
2994
+ "奨しています。これにより、異なるメソッドを必要とする :func:`max` のような他の"
2995
+ "ソートツールを、同じデータに対して適用することによって起こりうるバグを避ける"
2996
+ "助けになります。6つの比較演算子を全て実装することは、リフレクションによって :"
2997
+ "meth:`~object.__gt__` メソッドを呼び出す可能性のある型混合の比較での混乱を避"
2998
+ "けることにも役立ちます。 "
2991
2999
2992
3000
#: ../../library/functions.rst:1643
2993
3001
msgid ""
@@ -3021,6 +3029,9 @@ msgid ""
3021
3029
"an instance (such as ``C().f()``). Moreover, they can be called as regular "
3022
3030
"functions (such as ``f()``)."
3023
3031
msgstr ""
3032
+ "静的メソッドは (``C.f()`` のように) クラスに対して呼び出すことも、 (``C()."
3033
+ "f()`` のように) インスタンスに対して呼び出すこともできます。さらに、 "
3034
+ "(``f()`` のように) 普通の関数として呼び出すこともできます。"
3024
3035
3025
3036
#: ../../library/functions.rst:1663
3026
3037
msgid ""
@@ -3056,6 +3067,10 @@ msgid ""
3056
3067
"``__name__``, ``__qualname__``, ``__doc__`` and ``__annotations__``), have a "
3057
3068
"new ``__wrapped__`` attribute, and are now callable as regular functions."
3058
3069
msgstr ""
3070
+ "静的メソッドはメソッド属性 (``__module__``, ``__name__``, ``__qualname__``, "
3071
+ "``__doc__`` そして ``__annotations__``) を継承するようになり、また新たに "
3072
+ "``__wrapped__`` 属性を持つようになりました。さらに、静的メソッドを通常の関数"
3073
+ "として呼び出すことができるようになりました。"
3059
3074
3060
3075
#: ../../library/functions.rst:1696
3061
3076
msgid ""
@@ -3171,6 +3186,14 @@ msgid ""
3171
3186
"changes in the class hierarchy, and because that order can include sibling "
3172
3187
"classes that are unknown prior to runtime)."
3173
3188
msgstr ""
3189
+ "2つ目の用途は動的な実行環境において協調的 (cooperative) な多重継承をサポート"
3190
+ "することです。これは Python に特有の用途で、静的にコンパイルされる言語や、単"
3191
+ "継承のみをサポートする言語には見られないものです。この機能により、同じ名前の"
3192
+ "メソッドを実装する複数の基底クラスを使った \" ダイヤモンド型* の継承構造を実装"
3193
+ "することができます。良い設計は、そのような実装において、どのような場合でも同"
3194
+ "じ呼び出しシグネチャを持つように強制します。 (理由は呼び出しの順序が実行時に"
3195
+ "決定されること、呼び出し順序はクラス階層構造の変化に順応すること、そして呼び"
3196
+ "出し順序が実行時まで未知の兄弟クラスが含まれる場合があることです)。"
3174
3197
3175
3198
#: ../../library/functions.rst:1756
3176
3199
msgid "For both use cases, a typical superclass call looks like this::"
@@ -3183,6 +3206,9 @@ msgid ""
3183
3206
"lookups. One possible use case for this is calling :term:`descriptors "
3184
3207
"<descriptor>` in a parent or sibling class."
3185
3208
msgstr ""
3209
+ "メソッドのルックアップに加えて、 :func:`super` は属性のルックアップに対しても"
3210
+ "同様に動作します。考えうる用途のひとつは親クラスや兄弟クラスの :term:"
3211
+ "`descriptors <descriptor>` (デスクリプタ) を呼び出すことです。"
3186
3212
3187
3213
#: ../../library/functions.rst:1767
3188
3214
msgid ""
@@ -3263,6 +3289,14 @@ msgid ""
3263
3289
"the :attr:`~object.__dict__` attribute. The following two statements create "
3264
3290
"identical :class:`type` objects:"
3265
3291
msgstr ""
3292
+ "引数が3つの場合、新しい型オブジェクトを返します。これは本質的には :keyword:"
3293
+ "`class` 文の動的な書式です。 *name* 文字列はクラス名で、 :attr:`~definition."
3294
+ "__name__` 属性になります。 *bases* 基底クラスのタプルで、 :attr:`~class."
3295
+ "__bases__` 属性になります; 空の場合は全てのクラスの基底クラスである :class:"
3296
+ "`object` が追加されます。 *dict* は、クラス本体の属性とメソッドの定義を含む辞"
3297
+ "書です; 辞書は :attr:`~object.__dict__` 属性になる前にコピーされたり、ラップ"
3298
+ "されることがあります。以下の2つの文は同じ :class:`type` オブジェクトを生成し"
3299
+ "ます:"
3266
3300
3267
3301
#: ../../library/functions.rst:1822
3268
3302
msgid "See also :ref:`bltin-type-objects`."
@@ -3275,6 +3309,9 @@ msgid ""
3275
3309
"in the same way that keywords in a class definition (besides *metaclass*) "
3276
3310
"would."
3277
3311
msgstr ""
3312
+ "三引数形式の呼び出しに与えられたキーワード引数は、(*metaclass* を除く) クラス"
3313
+ "定義におけるキーワード引数と同様に、適切なメタクラスの機構 (通常は :meth:"
3314
+ "`~object.__init_subclass__`) に渡されます。"
3278
3315
3279
3316
#: ../../library/functions.rst:1829
3280
3317
msgid "See also :ref:`class-customization`."
@@ -3326,12 +3363,17 @@ msgid ""
3326
3363
"doesn't have a :attr:`~object.__dict__` attribute (for example, if its class "
3327
3364
"defines the :attr:`~object.__slots__` attribute)."
3328
3365
msgstr ""
3366
+ "指定されたオブジェクトに :attr:`~object.__dict__` 属性がない場合 (たとえばそ"
3367
+ "のクラスが :attr:`~object.__slots__` 属性を定義している場合)、 :exc:"
3368
+ "`TypeError` 例外が送出されます。"
3329
3369
3330
3370
#: ../../library/functions.rst:1855
3331
3371
msgid ""
3332
3372
"Iterate over several iterables in parallel, producing tuples with an item "
3333
3373
"from each one."
3334
3374
msgstr ""
3375
+ "複数のイテラブルを並行に反復処理し、各イテラブルの要素からなるタプルを生成し"
3376
+ "ます。"
3335
3377
3336
3378
#: ../../library/functions.rst:1858
3337
3379
msgid "Example::"
@@ -3342,20 +3384,28 @@ msgid ""
3342
3384
"More formally: :func:`zip` returns an iterator of tuples, where the *i*-th "
3343
3385
"tuple contains the *i*-th element from each of the argument iterables."
3344
3386
msgstr ""
3387
+ "より正式な定義: :func:`zip` は、 *i* 番目のタプルが 引数に与えた各イテラブル"
3388
+ "の *i* 番目の要素を含むような、タプルのイテレータを返します。"
3345
3389
3346
3390
#: ../../library/functions.rst:1870
3347
3391
msgid ""
3348
3392
"Another way to think of :func:`zip` is that it turns rows into columns, and "
3349
3393
"columns into rows. This is similar to `transposing a matrix <https://en."
3350
3394
"wikipedia.org/wiki/Transpose>`_."
3351
3395
msgstr ""
3396
+ ":func:`zip` に対する別の考え方は、この関数は行を列に、また列を行に変換すると"
3397
+ "いうことです。これは `行列の転置 <https://en.wikipedia.org/wiki/Transpose>`_ "
3398
+ "とよく似ています。"
3352
3399
3353
3400
#: ../../library/functions.rst:1874
3354
3401
msgid ""
3355
3402
":func:`zip` is lazy: The elements won't be processed until the iterable is "
3356
3403
"iterated on, e.g. by a :keyword:`!for` loop or by wrapping in a :class:"
3357
3404
"`list`."
3358
3405
msgstr ""
3406
+ ":func:`zip` は遅延評価です: イテラブルが :keyword:`!for` ループに渡された"
3407
+ "り、 :class:`list` でラップされたりするなどして反復処理されるまで、要素が実際"
3408
+ "に処理されることはありません。"
3359
3409
3360
3410
#: ../../library/functions.rst:1878
3361
3411
msgid ""
0 commit comments