1010# telnetning <[email protected] >, 20201111# Alpha Du <[email protected] >, 20201212# ppcfish <[email protected] >, 202013- # Freesand Leo <[email protected] >, 20221413# Dai Xu <[email protected] >, 202214+ # Freesand Leo <[email protected] >, 20221515#
1616#, fuzzy
1717msgid ""
@@ -20,7 +20,7 @@ msgstr ""
2020"Report-Msgid-Bugs-To : \n "
2121"POT-Creation-Date : 2021-01-01 16:06+0000\n "
2222"PO-Revision-Date : 2020-05-30 11:54+0000\n "
23- "Last-Translator : Dai Xu <daixu61@hotmail .com>, 2022\n "
23+ "Last-Translator : Freesand Leo <yuqinju@163 .com>, 2022\n "
2424"Language-Team : Chinese (China) (https://www.transifex.com/python-doc/teams/5390/zh_CN/)\n "
2525"MIME-Version : 1.0\n "
2626"Content-Type : text/plain; charset=UTF-8\n "
@@ -695,41 +695,41 @@ msgstr ""
695695msgid ""
696696"The default value you provide for a parameter can't be any arbitrary "
697697"expression. Currently the following are explicitly supported:"
698- msgstr ""
698+ msgstr "提供给参数的默认值不能是表达式。目前明确支持以下形式: "
699699
700700#: ../../howto/clinic.rst:564
701701msgid "Numeric constants (integer and float)"
702- msgstr ""
702+ msgstr "数值型常数(整数和浮点数)。 "
703703
704704#: ../../howto/clinic.rst:565
705705msgid "String constants"
706706msgstr "字符串常量"
707707
708708#: ../../howto/clinic.rst:566
709709msgid "``True``, ``False``, and ``None``"
710- msgstr ""
710+ msgstr "``True`` 、 ``False`` 和 ``None`` 。 "
711711
712712#: ../../howto/clinic.rst:567
713713msgid ""
714714"Simple symbolic constants like ``sys.maxsize``, which must start with the "
715715"name of the module"
716- msgstr ""
716+ msgstr "以模块名开头的简单符号常量,如 ``sys.maxsize``。 "
717717
718718#: ../../howto/clinic.rst:570
719719msgid ""
720720"In case you're curious, this is implemented in ``from_builtin()`` in "
721721"``Lib/inspect.py``."
722- msgstr ""
722+ msgstr "如果你感到好奇,这是在 ``from_builtin()`` ( ``Lib/inspect.py``) 中实现的。 "
723723
724724#: ../../howto/clinic.rst:573
725725msgid ""
726726"(In the future, this may need to get even more elaborate, to allow full "
727727"expressions like ``CONSTANT - 1``.)"
728- msgstr ""
728+ msgstr "(未来可能需要加以细化,以便可以采用 ``CONSTANT - 1`` 之类的完整表达式。) "
729729
730730#: ../../howto/clinic.rst:578
731731msgid "Renaming the C functions and variables generated by Argument Clinic"
732- msgstr ""
732+ msgstr "对 Argument Clinic 生成的 C 函数和变量进行重命名 "
733733
734734#: ../../howto/clinic.rst:580
735735msgid ""
@@ -742,18 +742,21 @@ msgid ""
742742"function, then add ``\" _impl\" `` to the end and use that for the name of the"
743743" impl function."
744744msgstr ""
745+ "Argument Clinic 会自动为其生成的函数命名。如果生成的名称与现有的 C 函数冲突,这偶尔可能会造成问题,有一个简单的解决方案:覆盖 C "
746+ "函数的名称。只要在函数声明中加入关键字 ``\" as\" `` ,然后再加上要使用的函数名。Argument Clinic "
747+ "将以该函数名为基础作为(生成的)函数名,然后在后面加上 ``\" _impl\" ``,并用作导入函数的名称。"
745748
746749#: ../../howto/clinic.rst:588
747750msgid ""
748751"For example, if we wanted to rename the C function names generated for "
749752"``pickle.Pickler.dump``, it'd look like this::"
750- msgstr ""
753+ msgstr "例如,若对 ``pickle.Pickler.dump`` 生成的 C 函数进行重命名,应如下所示: "
751754
752755#: ../../howto/clinic.rst:596
753756msgid ""
754757"The base function would now be named ``pickler_dumper()``, and the impl "
755758"function would now be named ``pickler_dumper_impl()``."
756- msgstr ""
759+ msgstr "原函数会被命名为 ``pickler_dumper()``,而实现函数现在被命名为``pickler_dumper_impl()``。 "
757760
758761#: ../../howto/clinic.rst:600
759762msgid ""
@@ -762,20 +765,23 @@ msgid ""
762765"Clinic allows you to give a parameter different names in Python and in C, "
763766"using the same ``\" as\" `` syntax::"
764767msgstr ""
768+ "同样的问题依然会出现:想给某个参数取个 Python 用名,但在 C 语言中可能用不了。Argument Clinic 允许在 Python 和 C "
769+ "中为同一个参数取不同的名字,语法依然是利用 ``\" as\" `` :"
765770
766771#: ../../howto/clinic.rst:614
767772msgid ""
768773"Here, the name used in Python (in the signature and the ``keywords`` array) "
769774"would be ``file``, but the C variable would be named ``file_obj``."
770775msgstr ""
776+ "这里 Python(签名和 ``keywords`` 数组中)中用的名称是 ``file``,而 C 语言中的变量命名为 ``file_obj``。"
771777
772778#: ../../howto/clinic.rst:617
773779msgid "You can use this to rename the ``self`` parameter too!"
774- msgstr ""
780+ msgstr "``self`` 参数也可以进行重命名。 "
775781
776782#: ../../howto/clinic.rst:621
777783msgid "Converting functions using PyArg_UnpackTuple"
778- msgstr ""
784+ msgstr "利用 PyArg_UnpackTuple 对函数进行转换 "
779785
780786#: ../../howto/clinic.rst:623
781787msgid ""
@@ -785,16 +791,18 @@ msgid ""
785791"type as appropriate. All arguments should be marked positional-only (add a "
786792"``/`` on a line by itself after the last argument)."
787793msgstr ""
794+ "若要将函数转换为采用 :c:func:`PyArg_UnpackTuple` 解析其参数,只需写出所有参数,并将每个参数定义为 "
795+ "``object``。可以指定 ``type`` 参数,以便能转换为合适的类型。所有参数都应标记为只认位置(在最后一个参数后面加上 ``/``)。"
788796
789797#: ../../howto/clinic.rst:629
790798msgid ""
791799"Currently the generated code will use :c:func:`PyArg_ParseTuple`, but this "
792800"will change soon."
793- msgstr ""
801+ msgstr "目前,所生成的代码将会用到 :c:func:`PyArg_ParseTuple` ,但很快会做出改动。 "
794802
795803#: ../../howto/clinic.rst:633
796804msgid "Optional Groups"
797- msgstr ""
805+ msgstr "可选参数组 "
798806
799807#: ../../howto/clinic.rst:635
800808msgid ""
@@ -806,6 +814,9 @@ msgid ""
806814"optional arguments back before :c:func:`PyArg_ParseTupleAndKeywords` was "
807815"created."
808816msgstr ""
817+ "有些过时的函数用到了一种让人头疼的函数解析方式:计算位置参数的数量,据此用 ``switch`` 语句进行各个不同的 "
818+ ":c:func:`PyArg_ParseTuple` 调用。(这些函数不能接受只认关键字的参数。)在没有 "
819+ ":c:func:`PyArg_ParseTupleAndKeywords` 之前,这种方式曾被用于模拟可选参数。"
809820
810821#: ../../howto/clinic.rst:642
811822msgid ""
@@ -820,6 +831,11 @@ msgid ""
820831" ``y``; if you call the function passing in ``x``, you must also pass in "
821832"``y``—and if you don't pass in ``x`` you may not pass in ``y`` either.)"
822833msgstr ""
834+ "虽然这种函数通常可以转换为采用 :c:func:`PyArg_ParseTupleAndKeywords` "
835+ "、可选参数和默认值的方式,但并不是全都可以做到。这些过时函数中, :c:func:`PyArg_ParseTupleAndKeywords` "
836+ "并不能直接支持某些功能。最明显的例子是内置函数 ``range()``,它的必需参数的 *左* 边存在一个可选参数!另一个例子是 "
837+ "``curses.window.addch()``,它的两个参数是一组,必须同时指定。(参数名为 ``x`` 和 ``y``;如果调用函数时传入了 "
838+ "``x``,则必须同时传入``y``;如果未传入 ``x`` ,则也不能传入 ``y``)。"
823839
824840#: ../../howto/clinic.rst:654
825841msgid ""
@@ -831,6 +847,9 @@ msgid ""
831847"required arguments. They can *only* be used with positional-only "
832848"parameters."
833849msgstr ""
850+ "不管怎么说,Argument Clinic 的目标就是在不改变语义的情况下支持所有现有 CPython 内置参数的解析。因此,Argument "
851+ "Clinic 采用所谓的 *可选组* 方案来支持这种解析方式。可选组是必须一起传入的参数组。他们可以在必需参数的左边或右边,*只能* "
852+ "用于只认位置的参数。"
834853
835854#: ../../howto/clinic.rst:662
836855msgid ""
@@ -842,6 +861,9 @@ msgid ""
842861"doesn't understand the concept. Please avoid using optional groups wherever"
843862" possible."
844863msgstr ""
864+ "可选组 *仅* 适用于多次调用 :c:func:`PyArg_ParseTuple` 的函数!采用 *任何* 其他方式解析参数的函数,应该 *几乎不* "
865+ "采用可选组转换为 Argument Clinic 解析。目前,采用可选组的函数在 Python 中无法获得准确的签名,因为 Python "
866+ "不能理解这个概念。请尽可能避免使用可选组。"
845867
846868#: ../../howto/clinic.rst:671
847869msgid ""
@@ -851,6 +873,8 @@ msgid ""
851873"optional groups to make the first two parameters and the last parameter "
852874"optional::"
853875msgstr ""
876+ "若要定义可选组,可在要分组的参数前面加上 ``[``,在这些参数后加上``]`` ,要在同一行上。举个例子,下面是 "
877+ "``curses.window.addch`` 采用可选组的用法,前两个参数和最后一个参数可选:"
854878
855879#: ../../howto/clinic.rst:700
856880msgid "Notes:"
@@ -868,22 +892,26 @@ msgid ""
868892"was unused, and set to non-zero if this group was used. (By used or unused, "
869893"I mean whether or not the parameters received arguments in this invocation.)"
870894msgstr ""
895+ "每一个可选组,都会额外传入一个代表分组的参数。 参数为 int 型,名为 ``group_{direction}_{number}``,其中 "
896+ "``{direction}`` 取决于此参数组位于必需参数 ``right`` 还是 ``left``,而 ``{number}`` 是一个递增数字(从"
897+ " 1 开始),表示此参数组与必需参数之间的距离。 在调用函数时,若未用到此参数组则此参数将设为零,若用到了参数组则该参数为非零。 "
898+ "所谓的用到或未用到,是指在本次调用中形参是否收到了实参。"
871899
872900#: ../../howto/clinic.rst:713
873901msgid ""
874902"If there are no required arguments, the optional groups will behave as if "
875903"they're to the right of the required arguments."
876- msgstr ""
904+ msgstr "如果不存在必需参数,可选组的行为等同于出现在必需参数的右侧。 "
877905
878906#: ../../howto/clinic.rst:716
879907msgid ""
880908"In the case of ambiguity, the argument parsing code favors parameters on the"
881909" left (before the required parameters)."
882- msgstr ""
910+ msgstr "在模棱两可的情况下,参数解析代码更倾向于参数左侧(在必需参数之前)。 "
883911
884912#: ../../howto/clinic.rst:719
885913msgid "Optional groups can only contain positional-only parameters."
886- msgstr ""
914+ msgstr "可选组只能包含只认位置的参数。 "
887915
888916#: ../../howto/clinic.rst:721
889917msgid ""
0 commit comments