@@ -12,7 +12,7 @@ msgid ""
12
12
msgstr ""
13
13
"Project-Id-Version : Python 3.10\n "
14
14
"Report-Msgid-Bugs-To : \n "
15
- "POT-Creation-Date : 2024-02-23 19:03 +0000\n "
15
+ "POT-Creation-Date : 2024-02-25 03:11 +0000\n "
16
16
"PO-Revision-Date : 2022-11-05 17:21+0000\n "
17
17
"
Last-Translator :
Rafael Fontenelle <[email protected] >, 2024\n "
18
18
"Language-Team : Chinese (China) (https://app.transifex.com/python-doc/teams/5390/zh_CN/)\n "
@@ -566,8 +566,8 @@ msgid ""
566
566
":exc:`TypeError`. If values in ``changes`` do not specify fields, raises "
567
567
":exc:`TypeError`."
568
568
msgstr ""
569
- "创建一个与 ``obj`` 类型相同的新对象,将字段替换为 ``changes`` 里的值。如果 ``obj`` 不是数据类,引发 "
570
- ":exc:`TypeError` 。如果 ``changes`` 里的值没有指定要替换的字段名,引发 :exc:`TypeError`。"
569
+ "创建一个与 ``obj`` 类型相同的新对象,将字段替换为 ``changes`` 里的值。如果 ``obj`` 不是数据类,则抛出 "
570
+ ":exc:`TypeError` 。如果 ``changes`` 里的值没有指定要替换的字段名,则抛出 :exc:`TypeError`。"
571
571
572
572
#: ../../library/dataclasses.rst:417
573
573
msgid ""
@@ -590,7 +590,8 @@ msgstr ""
590
590
msgid ""
591
591
"It is an error for ``changes`` to contain any fields that are defined as "
592
592
"having ``init=False``. A :exc:`ValueError` will be raised in this case."
593
- msgstr "``changes`` 试图为任何定义为 ``init=False`` 的字段赋值,会引发 :exc:`ValueError`。"
593
+ msgstr ""
594
+ "``changes`` 包含任何定义为 ``init=False`` 的字段是错误的。在这种情况下会引发 :exc:`ValueError` 。"
594
595
595
596
#: ../../library/dataclasses.rst:429
596
597
msgid ""
@@ -602,10 +603,9 @@ msgid ""
602
603
"perhaps a custom ``replace()`` (or similarly named) method which handles "
603
604
"instance copying."
604
605
msgstr ""
605
- "提前提醒 ``init=False`` 字段在 :func:`replace` 被调用时的行为。如果它们被初始化的话,它们不是从源对象复制的,而是在 "
606
- ":meth:`__post_init__` 中初始化。除非保持审慎,否则 ``init=False`` "
607
- "字段大概很少能被正确地使用。如果使用它们,那么使用另外的类构造器,或自定义 ``replace()`` "
608
- "方法(或类似名称的方法)来复制实例,可能是明智的选择。"
606
+ "提前提醒, 字段在 :func:`replace` 被调用时的行为是,当它们被初始化时,不是从源对象直接复制,而是在 "
607
+ ":meth:`__post_init__` 中初始化。除非保持审慎,否则 ``init=False`` 字段大概很少能被正确地使用。如果有使用 "
608
+ "``init=False`` 的字段,那么使用另外的类构造器,或自定义 ``replace()`` 方法(或类似名称的方法)来复制实例,可能会更好。"
609
609
610
610
#: ../../library/dataclasses.rst:440
611
611
msgid ""
@@ -928,7 +928,7 @@ msgstr "使用默认工厂函数是一种创建可变类型新实例的方法,
928
928
929
929
#: ../../library/dataclasses.rst:732
930
930
msgid "Descriptor-typed fields"
931
- msgstr "字段标注描述器类型 "
931
+ msgstr "描述器类型的字段 "
932
932
933
933
#: ../../library/dataclasses.rst:734
934
934
msgid ""
@@ -960,13 +960,13 @@ msgid ""
960
960
"hand, if the descriptor raises :exc:`AttributeError` in this situation, no "
961
961
"default value will be provided for the field."
962
962
msgstr ""
963
- "检测一个字段是否存在默认值时 ,``dataclasses`` 将使用类方法(即``descriptor.__get__(obj=None, "
964
- "type=cls)`` )调用描述器的``__get__`` 方法。 在这种情况下,如果描述器拥有返回值 "
963
+ "检测一个字段是否存在默认值时 ,``dataclasses`` 将使用类方法(即 ``descriptor.__get__(obj=None, "
964
+ "type=cls)`` )调用描述器的 ``__get__`` 方法。 在这种情况下,如果描述器拥有返回值 "
965
965
",则返回值为该字段的默认值。如果在这种情况下描述器抛出 :exc:`AttributeError` 错误,则该字段不存在默认值。"
966
966
967
967
#: ../../library/dataclasses.rst:778
968
968
msgid ""
969
969
"Note that if a field is annotated with a descriptor type, but is not "
970
970
"assigned a descriptor object as its default value, the field will act like a"
971
971
" normal field."
972
- msgstr "若一个字段被标注为描述器类型 ,但其默认值并不是描述器对象,那么该字段的效果只会像普通的字段一样 。"
972
+ msgstr "若一个字段的类型是描述器 ,但其默认值并不是描述器对象,那么该字段只会像普通的字段一样工作 。"
0 commit comments