Skip to content

Commit 20f6d10

Browse files
[po] auto sync
1 parent c53bc4d commit 20f6d10

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

extending/newtypes_tutorial.po

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -587,12 +587,15 @@ msgid ""
587587
"non-``NULL`` values, the members can be set to ``NULL`` if the attributes "
588588
"are deleted."
589589
msgstr ""
590+
"此方式的缺点之一是它没有提供限制可被赋值给 Python 属性的对象类型的办法。 我们预期 first 和 last "
591+
"的名称为字符串,但它们可以被赋值为任意 Python 对象。 此外,这些属性还可以被删除,并将 C 指针设为 ``NULL``。 "
592+
"即使我们可以保证这些成员被初始化为非 ``NULL`` 值,如果这些属性被删除这些成员仍可被设为 ``NULL``。"
590593

591594
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/extending/newtypes_tutorial.rst:462
592595
msgid ""
593596
"We define a single method, :meth:`Custom.name()`, that outputs the objects "
594597
"name as the concatenation of the first and last names. ::"
595-
msgstr ""
598+
msgstr "我们定义了一个单独的方法,:meth:`Custom.name()`,它将对象名称输出为 first 和 last 名称的拼接。 ::"
596599

597600
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/extending/newtypes_tutorial.rst:479
598601
msgid ""
@@ -603,6 +606,9 @@ msgid ""
603606
" to accept a positional argument tuple or keyword argument dictionary. This "
604607
"method is equivalent to the Python method:"
605608
msgstr ""
609+
"该方法的实现形式是一个接受 :class:`Custom` (或 :class:`Custom` 的子类) 实例作为第一个参数的 C 函数。 "
610+
"方法总是接受一个实例作为第一个参数。 方法也总是接受位置和关键字参数,但在本例中我们未接受任何参数也不需要接受位置参数元组或关键字参数字典。 "
611+
"该方法等价于以下 Python 方法:"
606612

607613
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/extending/newtypes_tutorial.rst:491
608614
msgid ""
@@ -612,22 +618,25 @@ msgid ""
612618
" of these attributes and to restrict the attribute values to be strings. "
613619
"We'll see how to do that in the next section."
614620
msgstr ""
621+
"请注意我们必须检查我们的 :attr:`first` 和 :attr:`last` 成员是否可能为 ``NULL``。 "
622+
"这是因为它们可以被删除,在此情况下它们会被设为 ``NULL``。 更好的做法是防止删除这些属性并将属性的值限制为字符串。 "
623+
"我们将在下一节了解如何做到这一点。"
615624

616625
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/extending/newtypes_tutorial.rst:497
617626
msgid ""
618627
"Now that we've defined the method, we need to create an array of method "
619628
"definitions::"
620-
msgstr ""
629+
msgstr "现在我们已经定义好了方法,我们需要创建一个方法定义数组::"
621630

622631
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/extending/newtypes_tutorial.rst:507
623632
msgid ""
624633
"(note that we used the :const:`METH_NOARGS` flag to indicate that the method"
625634
" is expecting no arguments other than *self*)"
626-
msgstr ""
635+
msgstr "(请注意我们使用 :const:`METH_NOARGS` 旗标来指明该方法不准备接受 *self* 以外的任何参数)"
627636

628637
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/extending/newtypes_tutorial.rst:510
629638
msgid "and assign it to the :c:member:`~PyTypeObject.tp_methods` slot::"
630-
msgstr ""
639+
msgstr "并将其赋给 :c:member:`~PyTypeObject.tp_methods` 槽位::"
631640

632641
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/extending/newtypes_tutorial.rst:514
633642
msgid ""
@@ -636,21 +645,25 @@ msgid ""
636645
" about the type of the object being created or used, so all we need to do is"
637646
" to add the :const:`Py_TPFLAGS_BASETYPE` to our class flag definition::"
638647
msgstr ""
648+
"最后,我们将使我们的类型可被用作派生子类的基类。 我们精心地编写我们的方法以便它们不会随意假定被创建或使用的对象类型,所以我们需要做的就是将 "
649+
":const:`Py_TPFLAGS_BASETYPE` 添加到我们的类旗标定义中::"
639650

640651
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/extending/newtypes_tutorial.rst:521
641652
msgid ""
642653
"We rename :c:func:`PyInit_custom` to :c:func:`PyInit_custom2`, update the "
643654
"module name in the :c:type:`PyModuleDef` struct, and update the full class "
644655
"name in the :c:type:`PyTypeObject` struct."
645656
msgstr ""
657+
"我们将 :c:func:`PyInit_custom` 重命名为 :c:func:`PyInit_custom2`,更新 "
658+
":c:type:`PyModuleDef` 结构体中的模块名,并更新 :c:type:`PyTypeObject` 结构体中的完整类名。"
646659

647660
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/extending/newtypes_tutorial.rst:525
648661
msgid "Finally, we update our :file:`setup.py` file to build the new module:"
649-
msgstr ""
662+
msgstr "最后,我们更新我们的 :file:`setup.py` 文件来生成新的模块。"
650663

651664
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/extending/newtypes_tutorial.rst:538
652665
msgid "Providing finer control over data attributes"
653-
msgstr ""
666+
msgstr "提供对于数据属性的更精细控制Providing finer control over data attributes"
654667

655668
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/extending/newtypes_tutorial.rst:540
656669
msgid ""
@@ -932,7 +945,7 @@ msgstr "备注"
932945
msgid ""
933946
"This is true when we know that the object is a basic type, like a string or "
934947
"a float."
935-
msgstr ""
948+
msgstr "当我们知道该对象属于基本类型,如字符串或浮点数时情况就是如此。"
936949

937950
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/extending/newtypes_tutorial.rst:896
938951
msgid ""

0 commit comments

Comments
 (0)