Skip to content

Commit f72e6d0

Browse files
author
github-actions
committed
Merge 3.11 into 3.10
1 parent 56e4212 commit f72e6d0

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

library/stdtypes.po

+45
Original file line numberDiff line numberDiff line change
@@ -6586,6 +6586,10 @@ msgid ""
65866586
"to signify a :class:`set` in which all the elements are of type :class:"
65876587
"`bytes`."
65886588
msgstr ""
6589+
"コンテナクラスに対してクラスの :ref:`添字表記 <subscriptions>` に与えられた単"
6590+
"一または複数の引数は、そのオブジェクトが包含する要素の型をあらわします。たと"
6591+
"えば ``set[bytes]`` という表記は、全ての要素が :class:`bytes` であるような :"
6592+
"class:`set` をあらわす型アノテーションとして使うことができます。"
65896593

65906594
#: ../../library/stdtypes.rst:4823
65916595
msgid ""
@@ -6595,6 +6599,11 @@ msgid ""
65956599
"object. For example, :mod:`regular expressions <re>` can be used on both "
65966600
"the :class:`str` data type and the :class:`bytes` data type:"
65976601
msgstr ""
6602+
":meth:`~object.__class_getitem__` メソッドを定義しているけれどもコンテナでな"
6603+
"いクラスに対しては、クラスの添字表記に与えられた単一または複数の引数は、しば"
6604+
"しばオブジェクトに定義された単一または複数のメソッドの戻り値の型をあらわしま"
6605+
"す。たとえば、 :mod:`正規表現操作 <re>` は :class:`str` と :class:`bytes` の"
6606+
"両方のデータ型に対して使うことができます:"
65986607

65996608
#: ../../library/stdtypes.rst:4829
66006609
msgid ""
@@ -6603,6 +6612,10 @@ msgid ""
66036612
"both be of type :class:`str`. We can represent this kind of object in type "
66046613
"annotations with the ``GenericAlias`` ``re.Match[str]``."
66056614
msgstr ""
6615+
"``x = re.search('foo', 'foo')`` とした場合、 ``x`` は :ref:`re.Match <match-"
6616+
"objects>` オブジェクトとなり、 ``x.group(0)`` と ``x[0]`` の戻り値はどちら"
6617+
"も :class:`str` となります。このようなオブジェクトは、 ``GenericAlias`` を"
6618+
"使った型アノテーション ``re.Match[str]`` で表現することができます。"
66066619

66076620
#: ../../library/stdtypes.rst:4835
66086621
msgid ""
@@ -6612,20 +6625,32 @@ msgid ""
66126625
"annotations, we would represent this variety of :ref:`re.Match <match-"
66136626
"objects>` objects with ``re.Match[bytes]``."
66146627
msgstr ""
6628+
"``y = re.search(b'bar', b'bar')`` (ここで ``b`` は :class:`bytes` 型をあらわ"
6629+
"します) とした場合、``y`` もまた ``re.Match`` のインスタンスとなりますが、 "
6630+
"``y.group(0)`` と ``y[0]`` の戻り値はどちらも :class:`bytes` 型になります。型"
6631+
"アノテーションでは、このような :ref:`re.Match <match-objects>` オブジェクト"
6632+
"は ``re.Match[bytes]`` と表現することになるでしょう。"
66156633

66166634
#: ../../library/stdtypes.rst:4841
66176635
msgid ""
66186636
"``GenericAlias`` objects are instances of the class :class:`types."
66196637
"GenericAlias`, which can also be used to create ``GenericAlias`` objects "
66206638
"directly."
66216639
msgstr ""
6640+
"``GenericAlias`` オブジェクトは :class:`types.GenericAlias` クラスのインスタ"
6641+
"ンスです。このクラスは直接 ``GenericAlias`` オブジェクトを生成するのに使うこ"
6642+
"ともできます。"
66226643

66236644
#: ../../library/stdtypes.rst:4847
66246645
msgid ""
66256646
"Creates a ``GenericAlias`` representing a type ``T`` parameterized by types "
66266647
"*X*, *Y*, and more depending on the ``T`` used. For example, a function "
66276648
"expecting a :class:`list` containing :class:`float` elements::"
66286649
msgstr ""
6650+
"型 \"X\", \"Y\", またはさらに多くの引数でパラメータ化される型 ``T`` を表現す"
6651+
"る ``GenericAlias`` を生成します。引数の数は ``T`` の使われ方によって決まりま"
6652+
"す。たとえば、 :class:`float` 型の要素を含む :class:`list` を引数にとる関数の"
6653+
"型アノテーションは次のようになります::"
66296654

66306655
#: ../../library/stdtypes.rst:4855
66316656
msgid ""
@@ -6634,12 +6659,18 @@ msgid ""
66346659
"the value type. In this example, the function expects a ``dict`` with keys "
66356660
"of type :class:`str` and values of type :class:`int`::"
66366661
msgstr ""
6662+
"もうひとつの例として :term:`mapping` オブジェクトの場合を示します。ここでは"
6663+
"キーと値の2つの型をパラメータとするジェネリック型である :class:`dict` を使っ"
6664+
"ています。この例では、関数はキーが :class:`str` 型、値が :class:`int` 型であ"
6665+
"るような ``dict`` を引数にとります::"
66376666

66386667
#: ../../library/stdtypes.rst:4863
66396668
msgid ""
66406669
"The builtin functions :func:`isinstance` and :func:`issubclass` do not "
66416670
"accept ``GenericAlias`` types for their second argument::"
66426671
msgstr ""
6672+
"組み込み関数 :func:`isinstance` と :func:`issubclass` は第二引数として "
6673+
"``GenericAlias`` 型を指定することはできません::"
66436674

66446675
#: ../../library/stdtypes.rst:4871
66456676
msgid ""
@@ -6649,31 +6680,45 @@ msgid ""
66496680
"not checked against their type. For example, the following code is "
66506681
"discouraged, but will run without errors::"
66516682
msgstr ""
6683+
"Python 実行時には :term:`型アノテーション <annotation>` は強制されません。こ"
6684+
"の性質はジェネリック型とその型パラメータにもおよびます。 ``GenericAlias`` か"
6685+
"らコンテナオブジェクトを生成した場合、コンテナ内の要素は型のチェックを受けま"
6686+
"せん。たとえば、以下のコードは推奨されませんが、エラーになることなく実行でき"
6687+
"ます::"
66526688

66536689
#: ../../library/stdtypes.rst:4881
66546690
msgid ""
66556691
"Furthermore, parameterized generics erase type parameters during object "
66566692
"creation::"
66576693
msgstr ""
6694+
"しかも、パラメータ付きジェネリック型は、オブジェクト生成時にパラメータの型情"
6695+
"報を削除します::"
66586696

66596697
#: ../../library/stdtypes.rst:4892
66606698
msgid ""
66616699
"Calling :func:`repr` or :func:`str` on a generic shows the parameterized "
66626700
"type::"
66636701
msgstr ""
6702+
":func:`repr` や :func:`str` のジェネリック型に対する呼び出しは、パラメータ型"
6703+
"を表示します::"
66646704

66656705
#: ../../library/stdtypes.rst:4900
66666706
msgid ""
66676707
"The :meth:`~object.__getitem__` method of generic containers will raise an "
66686708
"exception to disallow mistakes like ``dict[str][str]``::"
66696709
msgstr ""
6710+
"ジェネリックコンテナ型の :meth:`~object.__getitem__` メソッドは、 ``dict[str]"
6711+
"[str]`` のようなミスを許さないように、例外を送出します::"
66706712

66716713
#: ../../library/stdtypes.rst:4908
66726714
msgid ""
66736715
"However, such expressions are valid when :ref:`type variables <generics>` "
66746716
"are used. The index must have as many elements as there are type variable "
66756717
"items in the ``GenericAlias`` object's :attr:`~genericalias.__args__`. ::"
66766718
msgstr ""
6719+
"一方で、同様の式は :ref:`型変数 <generics>` が使われた場合は有効です。添字の"
6720+
"数は``GenericAlias`` オブジェクトの :attr:`~genericalias.__args__` 属性におけ"
6721+
"る型変数の数と同じでなければなりません::"
66776722

66786723
#: ../../library/stdtypes.rst:4919
66796724
msgid "Standard Generic Classes"

0 commit comments

Comments
 (0)