@@ -1628,6 +1628,8 @@ msgid ""
16281628"interpreter, it's best to restrict yourself to modules that are preloaded by"
16291629" Python itself.)"
16301630msgstr ""
1631+ "如果表达式不在当前模块中,就会去 ``sys.modules`` 查找。比如 ``sys.maxsize`` "
1632+ "就是如此找到的。(因为事先不知道用户会加载哪些模块到解释器中,所以最好只用到 Python 会预加载的模块。)"
16311633
16321634#: ../../howto/clinic.rst:1000
16331635msgid ""
@@ -1636,6 +1638,8 @@ msgid ""
16361638"explicitly. When you use an expression, you must also specify the equivalent"
16371639" expression in C, using the ``c_default`` parameter to the converter:"
16381640msgstr ""
1641+ "仅当运行时才对缺省值求值,意味着 Argument Clinic 无法计算出正确的 C "
1642+ "缺省值。所以需显式给出。在使用表达式时,必须同时用转换器的``c_default`` 参数指定 C 语言中的等价表达式。"
16391643
16401644#: ../../howto/clinic.rst:1009
16411645msgid ""
@@ -1644,37 +1648,39 @@ msgid ""
16441648"legal, but it can't *actually* know. You must be very careful when using "
16451649"expressions to specify values that are guaranteed to be valid at runtime!"
16461650msgstr ""
1651+ "还有一个问题也比较复杂。Argument Clinic 无法事先知道表达式是否有效。 解析只能保证看起来是有效值,但无法 *实际* "
1652+ "知晓。在用表达式时须十分小心,确保在运行时能得到有效值。"
16471653
16481654#: ../../howto/clinic.rst:1014
16491655msgid ""
16501656"Finally, because expressions must be representable as static C values, there"
16511657" are many restrictions on legal expressions. Here's a list of Python "
16521658"features you're not permitted to use:"
1653- msgstr ""
1659+ msgstr "最后一点,由于表达式必须能表示为静态的 C 语言值,所以存在许多限制。 以下列出了不得使用的 Python 特性: "
16541660
16551661#: ../../howto/clinic.rst:1018
16561662msgid "Function calls."
1657- msgstr ""
1663+ msgstr "功能调用 "
16581664
16591665#: ../../howto/clinic.rst:1019
16601666msgid "Inline if statements (``3 if foo else 5``)."
1661- msgstr ""
1667+ msgstr "行内 if 语句(``3 if foo else 5`` ) "
16621668
16631669#: ../../howto/clinic.rst:1020
16641670msgid "Automatic sequence unpacking (``*[1, 2, 3]``)."
1665- msgstr ""
1671+ msgstr "序列自动解包(``*[1, 2, 3]``) "
16661672
16671673#: ../../howto/clinic.rst:1021
16681674msgid "List/set/dict comprehensions and generator expressions."
1669- msgstr ""
1675+ msgstr "列表/集合/字典的解析和生成器表达式。 "
16701676
16711677#: ../../howto/clinic.rst:1022
16721678msgid "Tuple/list/set/dict literals."
1673- msgstr ""
1679+ msgstr "元组、列表、集合、字典的字面量 "
16741680
16751681#: ../../howto/clinic.rst:1027
16761682msgid "Using a return converter"
1677- msgstr ""
1683+ msgstr "返回转换器 "
16781684
16791685#: ../../howto/clinic.rst:1029
16801686msgid ""
@@ -1685,13 +1691,18 @@ msgid ""
16851691" have it convert your return value from a native C type into a Python type "
16861692"too?"
16871693msgstr ""
1694+ "Argument Clinic 生成的植入函数默认会返回 ``PyObject *``。但是通常 C 函数的任务是要对某些 C "
1695+ "类型进行计算,然后将其转换为 ``PyObject *`` 作为结果。Argument Clinic 可以将输入参数由 Python 类型转换为本地 C"
1696+ " 类型——为什么不让它将返回值由本地 C 类型转换为 Python 类型呢?"
16881697
16891698#: ../../howto/clinic.rst:1035
16901699msgid ""
16911700"That's what a \" return converter\" does. It changes your impl function to "
16921701"return some C type, then adds code to the generated (non-impl) function to "
16931702"handle converting that value into the appropriate ``PyObject *``."
16941703msgstr ""
1704+ "这就是“返回转换器”的用途。它将植入函数修改成返回某种 C 语言类型,然后在生成的(非植入)函数中添加代码,以便将 C 语言值转换为合适的 "
1705+ "``PyObject *``。"
16951706
16961707#: ../../howto/clinic.rst:1039
16971708msgid ""
@@ -1702,12 +1713,13 @@ msgid ""
17021713"you're not changing any of the default arguments you can omit the "
17031714"parentheses."
17041715msgstr ""
1716+ "返回值转换器的语法与参数转换器的类似。返回值转换器的定义方式,类似于函数返回值的注解。返回值转换器的行为与参数转换器基本相同,接受参数,参数只认关键字,如果不修改默认参数则可省略括号。"
17051717
17061718#: ../../howto/clinic.rst:1045
17071719msgid ""
17081720"(If you use both ``\" as\" `` *and* a return converter for your function, the "
17091721"``\" as\" `` should come before the return converter.)"
1710- msgstr ""
1722+ msgstr "(如果函数同时用到了 `` \" as \" `` 和返回值转换器, `` \" as \" `` 应位于返回值转换器之前。) "
17111723
17121724#: ../../howto/clinic.rst:1048
17131725msgid ""
0 commit comments