@@ -3043,19 +3043,19 @@ msgstr ""
30433043msgid ""
30443044"The ``type.__new__`` method collects all of the attributes in the class "
30453045"namespace that define a :meth:`~object.__set_name__` method;"
3046- msgstr ""
3046+ msgstr "``type.__new__`` 方法会收集类命名空间中所有定义了 :meth:`~object.__set_name__` 方法的属性; "
30473047
30483048#: ../../reference/datamodel.rst:2128
30493049msgid ""
30503050"Those ``__set_name__`` methods are called with the class being defined and "
30513051"the assigned name of that particular attribute;"
3052- msgstr ""
3052+ msgstr "这些 ``__set_name__`` 方法将附带所定义的类和指定的属性所赋的名称进行调用; "
30533053
30543054#: ../../reference/datamodel.rst:2130
30553055msgid ""
30563056"The :meth:`~object.__init_subclass__` hook is called on the immediate parent"
30573057" of the new class in its method resolution order."
3058- msgstr ""
3058+ msgstr "在新类基于方法解析顺序所确定的直接父类上调用 :meth:`~object.__init_subclass__` 钩子。 "
30593059
30603060#: ../../reference/datamodel.rst:2133
30613061msgid ""
@@ -3169,14 +3169,17 @@ msgid ""
31693169"notation. For example, the annotation ``list[int]`` might be used to signify"
31703170" a :class:`list` in which all the elements are of type :class:`int`."
31713171msgstr ""
3172+ "当使用 :term:`类型标注 <annotation>` 时,使用 Python 的方括号标记来 *形参化* 一个 :term:`generic "
3173+ "type` 往往会很有用处。 例如,``list[int]`` 这样的标注可以被用来表示一个 :class:`list` 中的所有元素均为 "
3174+ ":class:`int` 类型。"
31723175
31733176#: ../../reference/datamodel.rst:2208
31743177msgid ":pep:`484` - Type Hints"
31753178msgstr ":pep:`484` —— 类型注解"
31763179
31773180#: ../../reference/datamodel.rst:2208
31783181msgid "Introducing Python's framework for type annotations"
3179- msgstr ""
3182+ msgstr "介绍 Python 中用于类型标注的框架 "
31803183
31813184#: ../../reference/datamodel.rst:2211
31823185msgid ":ref:`Generic Alias Types<types-genericalias>`"
@@ -3223,14 +3226,16 @@ msgstr ""
32233226
32243227#: ../../reference/datamodel.rst:2231
32253228msgid "The purpose of *__class_getitem__*"
3226- msgstr ""
3229+ msgstr "*__class_getitem__* 的目的 "
32273230
32283231#: ../../reference/datamodel.rst:2233
32293232msgid ""
32303233"The purpose of :meth:`~object.__class_getitem__` is to allow runtime "
32313234"parameterization of standard-library generic classes in order to more easily"
32323235" apply :term:`type hints<type hint>` to these classes."
32333236msgstr ""
3237+ ":meth:`~object.__class_getitem__` 的目的是允许标准库泛型类的运行时形参化以更方便地对这些类应用 :term:`类型提示"
3238+ " <type hint>`。"
32343239
32353240#: ../../reference/datamodel.rst:2237
32363241msgid ""
@@ -3240,6 +3245,9 @@ msgid ""
32403245":meth:`~object.__class_getitem__`, or inherit from :class:`typing.Generic`, "
32413246"which has its own implementation of ``__class_getitem__()``."
32423247msgstr ""
3248+ "要实现可以在运行时被形参化并可被静态类型检查所理解的自定义泛型类,用户应当从已经实现了 "
3249+ ":meth:`~object.__class_getitem__` 的标准库类继承,或是从 :class:`typing.Generic` "
3250+ "继承,这个类拥有自己的 ``__class_getitem__()`` 实现。"
32433251
32443252#: ../../reference/datamodel.rst:2243
32453253msgid ""
@@ -3248,6 +3256,8 @@ msgid ""
32483256" type-checkers such as mypy. Using ``__class_getitem__()`` on any class for "
32493257"purposes other than type hinting is discouraged."
32503258msgstr ""
3259+ "标准库以外的类上的 :meth:`~object.__class_getitem__` 自定义实现可能无法被第三方类型检查器如 mypy 所理解。 "
3260+ "不建议在任何类上出于类型提示以外的目的使用 ``__class_getitem__()``。"
32513261
32523262#: ../../reference/datamodel.rst:2253
32533263msgid "*__class_getitem__* versus *__getitem__*"
0 commit comments