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 "
@@ -1490,16 +1490,19 @@ msgid ""
14901490":c:func:`PyBuffer_Release` on the provided buffer. Argument Clinic generates"
14911491" code that does it for you (in the parsing function)."
14921492msgstr ""
1493+ "在使用 ``Py_buffer`` 转换器(或者 ``'s*'``、``'w*'``、``'*y'`` 或 ``'z*'`` 传统转换器)时,*不可* "
1494+ "在所提供的缓冲区上调用 :c:func:`PyBuffer_Release`。 Argument Clinic "
1495+ "生成的代码会自动完成此操作(在解析函数中)。"
14931496
14941497#: ../../howto/clinic.rst:903
14951498msgid "Advanced converters"
1496- msgstr ""
1499+ msgstr "高级转换器 "
14971500
14981501#: ../../howto/clinic.rst:905
14991502msgid ""
15001503"Remember those format units you skipped for your first time because they "
15011504"were advanced? Here's how to handle those too."
1502- msgstr ""
1505+ msgstr "还记得初次尝试时跳过的那些格式单元吗,因为他们是高级内容?下面就来介绍这些内容。 "
15031506
15041507#: ../../howto/clinic.rst:908
15051508msgid ""
@@ -1511,6 +1514,10 @@ msgid ""
15111514"``O&``), ``subclass_of`` (for ``O!``), or ``encoding`` (for all the format "
15121515"units that start with ``e``)."
15131516msgstr ""
1517+ "其实诀窍在于,这些格式单元都需要给出参数——要么是转换函数,要么是类型,要么是指定编码的字符串。(但 "
1518+ "“传统转换器”不支持参数。这就是为什么第一个函数要跳过这些内容)。为格式单元指定的参数于是就成了转换器的参数;参数可以是 "
1519+ "``converter``(对于 ``O&``)、``subclass_of``(对于 ``O!``),或者是 ``encoding`` (对于 "
1520+ "``e`` 开头的格式单元)。"
15141521
15151522#: ../../howto/clinic.rst:916
15161523msgid ""
@@ -1520,6 +1527,9 @@ msgid ""
15201527"is a subclass of ``PyUnicode_Type``, you probably want to use the converter "
15211528"``object(type='PyUnicodeObject *', subclass_of='&PyUnicode_Type')``."
15221529msgstr ""
1530+ "在使用 ``subclass_of`` 时,可能还需要用到 ``object()`` "
1531+ "的另一个自定义参数:``type``,用于设置参数的实际类型。例如,为了确保对象是 ``PyUnicode_Type`` 的子类,可能想采用转换器 "
1532+ "``object(type='PyUnicodeObject *', subclass_of='&PyUnicode_Type')``。"
15231533
15241534#: ../../howto/clinic.rst:922
15251535msgid ""
@@ -1533,30 +1543,34 @@ msgid ""
15331543"unreasonable; CPython itself always passes in static hard-coded encoding "
15341544"strings for parameters whose format units start with ``e``."
15351545msgstr ""
1546+ "Argument Clinic 用起来可能存在一个问题:丧失了 ``e`` 开头的格式单位的一些灵活性。在手工编写 ``PyArg_Parse`` "
1547+ "调用时,理论上可以在运行时决定传给 :c:func:`PyArg_ParseTuple` 的编码字符串。但现在这个字符串必须在 Argument-"
1548+ "Clinic 预处理时进行硬编码。这个限制是故意设置的;以便简化对这种格式单元的支持,并允许以后进行优化。这个限制似乎并不合理;CPython "
1549+ "本身总是为 ``e`` 开头的格式单位参数传入静态的硬编码字符串。"
15361550
15371551#: ../../howto/clinic.rst:935
15381552msgid "Parameter default values"
1539- msgstr ""
1553+ msgstr "参数的默认值 "
15401554
15411555#: ../../howto/clinic.rst:937
15421556msgid ""
15431557"Default values for parameters can be any of a number of values. At their "
15441558"simplest, they can be string, int, or float literals:"
1545- msgstr ""
1559+ msgstr "参数的默认值可以是多个值中的一个。最简单的可以是字符串、int 或 float 字面量。 "
15461560
15471561#: ../../howto/clinic.rst:946
15481562msgid "They can also use any of Python's built-in constants:"
1549- msgstr ""
1563+ msgstr "还可以使用 Python 的任何内置常量。 "
15501564
15511565#: ../../howto/clinic.rst:954
15521566msgid ""
15531567"There's also special support for a default value of ``NULL``, and for simple"
15541568" expressions, documented in the following sections."
1555- msgstr ""
1569+ msgstr "对默认值 ``NULL`` 和简单表达式还提供特别的支持,后续章节中将会介绍。 "
15561570
15571571#: ../../howto/clinic.rst:959
15581572msgid "The ``NULL`` default value"
1559- msgstr ""
1573+ msgstr "默认值 ``NULL`` "
15601574
15611575#: ../../howto/clinic.rst:961
15621576msgid ""
@@ -1567,22 +1581,25 @@ msgid ""
15671581"behaves like a default value of ``None``, but the C variable is initialized "
15681582"with ``NULL``."
15691583msgstr ""
1584+ "对于字符串和对象参数而言,可以设为 ``None``,表示没有默认值。但这意味着会将 C 变量初始化为 "
1585+ "``Py_None``。为了方便起见,提供了一个特殊值``NULL``,目的就是为了让 Python 认为默认值就是 ``None``,而 C "
1586+ "变量则会初始化为 ``NULL``。"
15701587
15711588#: ../../howto/clinic.rst:969
15721589msgid "Expressions specified as default values"
1573- msgstr ""
1590+ msgstr "设为默认值的表达式 "
15741591
15751592#: ../../howto/clinic.rst:971
15761593msgid ""
15771594"The default value for a parameter can be more than just a literal value. It "
15781595"can be an entire expression, using math operators and looking up attributes "
15791596"on objects. However, this support isn't exactly simple, because of some "
15801597"non-obvious semantics."
1581- msgstr ""
1598+ msgstr "参数的默认值不仅可以是字面量。还可以是一个完整的表达式,可采用数学运算符及对象的属性。但这种支持并没有那么简单,因为存在一些不明显的语义。 "
15821599
15831600#: ../../howto/clinic.rst:976
15841601msgid "Consider the following example:"
1585- msgstr ""
1602+ msgstr "请考虑以下例子: "
15861603
15871604#: ../../howto/clinic.rst:982
15881605msgid ""
@@ -1591,6 +1608,8 @@ msgid ""
15911608" it in C. So it stores the default in such a way that it will get evaluated"
15921609" at runtime, when the user asks for the function's signature."
15931610msgstr ""
1611+ "``sys.maxsize`` 在不同的系统平台可能有不同的值。因此,Argument Clinic 不能简单地在本底环境对表达式求值并用 C "
1612+ "语言硬编码。所以默认值将用表达式的方式存储下来,运行的时候在请求函数签名时会被求值。"
15941613
15951614#: ../../howto/clinic.rst:987
15961615msgid ""
0 commit comments