@@ -16,7 +16,7 @@ msgid ""
1616msgstr ""
1717"Project-Id-Version : Python 3.12\n "
1818"Report-Msgid-Bugs-To : \n "
19- "POT-Creation-Date : 2023-08-25 22:29 +0000\n "
19+ "POT-Creation-Date : 2023-09-08 14:13 +0000\n "
2020"PO-Revision-Date : 2021-06-28 00:48+0000\n "
2121"
Last-Translator :
Freesand Leo <[email protected] >, 2023\n "
2222"Language-Team : Chinese (China) (https://app.transifex.com/python-doc/teams/5390/zh_CN/)\n "
@@ -93,18 +93,14 @@ msgstr ""
9393"使用 *key* 作为键将 *val* 插入字典 *p*。 *key* 必须为 :term:`hashable`;如果不是,则将引发 "
9494":exc:`TypeError`。 成功时返回 ``0``,失败时返回 ``-1``。 此函数 *不会* 附带对 *val* 的引用。"
9595
96- #: ../../c-api/dict.rst:75
96+ #: ../../c-api/dict.rst:73
9797msgid ""
98- "Insert *val* into the dictionary *p* using *key* as a key. *key* should be a"
99- " :c:expr:`const char*` UTF-8 encoded bytes string. The key object is "
100- "created using ``PyUnicode_FromString(key)``. Return ``0`` on success or "
101- "``-1`` on failure. This function *does not* steal a reference to *val*."
98+ "This is the same as :c:func:`PyDict_SetItem`, but *key* is specified as a "
99+ ":c:expr:`const char*` UTF-8 encoded bytes string, rather than a "
100+ ":c:expr:`PyObject*`."
102101msgstr ""
103- "使用 *key* 作为键将 *val* 插入到字典 *p* 中。 *key* 应为 :c:expr:`const char*` UTF-8 "
104- "编码的字节串。 键对象是使用 ``PyUnicode_FromString(key)`` 创建的。 成功时返回 ``0``,失败时返回 ``-1``。 "
105- "此函数 *不会* 偷取对 *val* 的引用。"
106102
107- #: ../../c-api/dict.rst:83
103+ #: ../../c-api/dict.rst:80
108104msgid ""
109105"Remove the entry in dictionary *p* with key *key*. *key* must be "
110106":term:`hashable`; if it isn't, :exc:`TypeError` is raised. If *key* is not "
@@ -115,23 +111,21 @@ msgstr ""
115111":exc:`TypeError`。 如果字典中没有 *key*,则会引发 :exc:`KeyError`。 成功时返回 ``0`` 或者失败时返回 "
116112"``-1``。"
117113
118- #: ../../c-api/dict.rst:91
114+ #: ../../c-api/dict.rst:88
119115msgid ""
120- "Remove the entry in dictionary *p* which has a key specified by the UTF-8 "
121- "encoded bytes string *key*. If *key* is not in the dictionary, "
122- ":exc:`KeyError` is raised. Return ``0`` on success or ``-1`` on failure ."
116+ "This is the same as :c:func:`PyDict_DelItem`, but *key* is specified as a "
117+ ":c:expr:`const char*` UTF-8 encoded bytes string, rather than a "
118+ ":c:expr:`PyObject*` ."
123119msgstr ""
124- "移除字典 *p* 中由 UTF-8 编码的字节串 *key* 指定的键的条目。 如果字典中不存在 *key*,则会引发 :exc:`KeyError`。"
125- " 成功时返回 ``0``,失败时返回 ``-1``。"
126120
127- #: ../../c-api/dict.rst:99
121+ #: ../../c-api/dict.rst:95
128122msgid ""
129123"Return the object from dictionary *p* which has a key *key*. Return "
130124"``NULL`` if the key *key* is not present, but *without* setting an "
131125"exception."
132126msgstr "从字典 *p* 中返回以 *key* 为键的对象。 如果键名 *key* 不存在但 *没有* 设置一个异常则返回 ``NULL``。"
133127
134- #: ../../c-api/dict.rst:104
128+ #: ../../c-api/dict.rst:100
135129msgid ""
136130"Exceptions that occur while this calls :meth:`~object.__hash__` and "
137131":meth:`~object.__eq__` methods are silently ignored. Prefer the "
@@ -140,13 +134,13 @@ msgstr ""
140134"在调用 :meth:`~object.__hash__` 和 :meth:`~object.__eq__` 方法时发生的异常将被静默地忽略。 建议改用 "
141135":c:func:`PyDict_GetItemWithError` 函数。"
142136
143- #: ../../c-api/dict.rst:108
137+ #: ../../c-api/dict.rst:104
144138msgid ""
145139"Calling this API without :term:`GIL` held had been allowed for historical "
146140"reason. It is no longer allowed."
147141msgstr "在不保持 :term:`GIL` 的情况下调用此 API 曾因历史原因而被允许。 现在已不再被允许。"
148142
149- #: ../../c-api/dict.rst:115
143+ #: ../../c-api/dict.rst:111
150144msgid ""
151145"Variant of :c:func:`PyDict_GetItem` that does not suppress exceptions. "
152146"Return ``NULL`` **with** an exception set if an exception occurred. Return "
@@ -155,7 +149,7 @@ msgstr ""
155149":c:func:`PyDict_GetItem` 的变种,它不会屏蔽异常。 当异常发生时将返回 ``NULL`` **并且** 设置一个异常。 "
156150"如果键不存在则返回 ``NULL`` **并且不会** 设置一个异常。"
157151
158- #: ../../c-api/dict.rst:123
152+ #: ../../c-api/dict.rst:119
159153msgid ""
160154"This is the same as :c:func:`PyDict_GetItem`, but *key* is specified as a "
161155":c:expr:`const char*` UTF-8 encoded bytes string, rather than a "
@@ -164,7 +158,7 @@ msgstr ""
164158"这与 :c:func:`PyDict_GetItem` 一样,但 *key* 是由一个 :c:expr:`const char*` UTF-8 "
165159"编码的字节串来指定的,而不是 :c:expr:`PyObject*`。"
166160
167- #: ../../c-api/dict.rst:129
161+ #: ../../c-api/dict.rst:125
168162msgid ""
169163"Exceptions that occur while this calls :meth:`~object.__hash__` and "
170164":meth:`~object.__eq__` methods or while creating the temporary :class:`str` "
@@ -176,7 +170,7 @@ msgstr ""
176170":class:`str` 对象期间发生的异常将被静默地忽略。 建议改用 :c:func:`PyDict_GetItemWithError` "
177171"函数并附带你自己的 :c:func:`PyUnicode_FromString` *key*。"
178172
179- #: ../../c-api/dict.rst:138
173+ #: ../../c-api/dict.rst:134
180174msgid ""
181175"This is the same as the Python-level :meth:`dict.setdefault`. If present, "
182176"it returns the value corresponding to *key* from the dictionary *p*. If the"
@@ -189,30 +183,30 @@ msgstr ""
189183"里面对应的值。如果键不存在,它会和值 *defaultobj* 一起插入并返回 *defaultobj* 。这个函数只计算 *key* "
190184"的哈希函数一次,而不是在查找和插入时分别计算它。"
191185
192- #: ../../c-api/dict.rst:148
186+ #: ../../c-api/dict.rst:144
193187msgid ""
194188"Return a :c:type:`PyListObject` containing all the items from the "
195189"dictionary."
196190msgstr "返回一个包含字典中所有键值项的 :c:type:`PyListObject`。"
197191
198- #: ../../c-api/dict.rst:153
192+ #: ../../c-api/dict.rst:149
199193msgid ""
200194"Return a :c:type:`PyListObject` containing all the keys from the dictionary."
201195msgstr "返回一个包含字典中所有键(keys)的 :c:type:`PyListObject`。"
202196
203- #: ../../c-api/dict.rst:158
197+ #: ../../c-api/dict.rst:154
204198msgid ""
205199"Return a :c:type:`PyListObject` containing all the values from the "
206200"dictionary *p*."
207201msgstr "返回一个包含字典中所有值(values)的 :c:type:`PyListObject`。"
208202
209- #: ../../c-api/dict.rst:166
203+ #: ../../c-api/dict.rst:162
210204msgid ""
211205"Return the number of items in the dictionary. This is equivalent to "
212206"``len(p)`` on a dictionary."
213207msgstr "返回字典中项目数,等价于对字典 *p* 使用 ``len(p)``。"
214208
215- #: ../../c-api/dict.rst:172
209+ #: ../../c-api/dict.rst:168
216210msgid ""
217211"Iterate over all key-value pairs in the dictionary *p*. The "
218212":c:type:`Py_ssize_t` referred to by *ppos* must be initialized to ``0`` "
@@ -230,18 +224,18 @@ msgstr ""
230224":c:expr:`PyObject*` 变量,它们将分别使用每个键和值来填充,或者也可以为 ``NULL``。 通过它们返回的任何引用都是暂借的。 "
231225"*ppos* 在迭代期间不应被更改。 它的值表示内部字典结构中的偏移量,并且由于结构是稀疏的,因此偏移量并不连续。"
232226
233- #: ../../c-api/dict.rst:183
227+ #: ../../c-api/dict.rst:179
234228msgid "For example::"
235229msgstr "例如:"
236230
237- #: ../../c-api/dict.rst:193
231+ #: ../../c-api/dict.rst:189
238232msgid ""
239233"The dictionary *p* should not be mutated during iteration. It is safe to "
240234"modify the values of the keys as you iterate over the dictionary, but only "
241235"so long as the set of keys does not change. For example::"
242236msgstr "字典 *p* 不应该在遍历期间发生改变。在遍历字典时,改变键中的值是安全的,但仅限于键的集合不发生改变。例如::"
243237
244- #: ../../c-api/dict.rst:218
238+ #: ../../c-api/dict.rst:214
245239msgid ""
246240"Iterate over mapping object *b* adding key-value pairs to dictionary *a*. "
247241"*b* may be a dictionary, or any object supporting :c:func:`PyMapping_Keys` "
@@ -254,7 +248,7 @@ msgstr ""
254248":c:func:`PyObject_GetItem` 的对象。 如果 *override* 为真值,则如果在 *b* 中找到相同的键则 *a* "
255249"中已存在的相应键值对将被替换,否则如果在 *a* 中没有相同的键则只是添加键值对。 当成功时返回 ``0`` 或者当引发异常时返回 ``-1``。"
256250
257- #: ../../c-api/dict.rst:228
251+ #: ../../c-api/dict.rst:224
258252msgid ""
259253"This is the same as ``PyDict_Merge(a, b, 1)`` in C, and is similar to "
260254"``a.update(b)`` in Python except that :c:func:`PyDict_Update` doesn't fall "
@@ -266,7 +260,7 @@ msgstr ""
266260":c:func:`PyDict_Update` 在第二个参数没有 \" keys\" 属性时不会回退到迭代键值对的序列。 当成功时返回 ``0`` "
267261"或者当引发异常时返回 ``-1``。"
268262
269- #: ../../c-api/dict.rst:237
263+ #: ../../c-api/dict.rst:233
270264msgid ""
271265"Update or merge into dictionary *a*, from the key-value pairs in *seq2*. "
272266"*seq2* must be an iterable object producing iterable objects of length 2, "
@@ -279,7 +273,7 @@ msgstr ""
279273"*override* 真值则最后出现的键胜出。 当成功时返回 ``0`` 或者当引发异常时返回 ``-1``。 等价的 Python "
280274"代码(返回值除外)::"
281275
282- #: ../../c-api/dict.rst:251
276+ #: ../../c-api/dict.rst:247
283277msgid ""
284278"Register *callback* as a dictionary watcher. Return a non-negative integer "
285279"id which must be passed to future calls to :c:func:`PyDict_Watch`. In case "
@@ -289,7 +283,7 @@ msgstr ""
289283"在字典上注册 *callback* 来作为 watcher。返回值为非负数的整数 id,作为将来调用 :c:func:`PyDict_Watch` "
290284"的时候使用。如果出现错误(比如没有足够的可用 watcher ID),返回 ``-1`` 并且设置异常。"
291285
292- #: ../../c-api/dict.rst:260
286+ #: ../../c-api/dict.rst:256
293287msgid ""
294288"Clear watcher identified by *watcher_id* previously returned from "
295289":c:func:`PyDict_AddWatcher`. Return ``0`` on success, ``-1`` on error (e.g. "
@@ -298,7 +292,7 @@ msgstr ""
298292"清空由之前从 :c:func:`PyDict_AddWatcher` 返回的 *watcher_id* 所标识的 watcher。 成功时返回 "
299293"``0``,出错时(例如当给定的 *watcher_id* 未被注册)返回 ``-1``。"
300294
301- #: ../../c-api/dict.rst:268
295+ #: ../../c-api/dict.rst:264
302296msgid ""
303297"Mark dictionary *dict* as watched. The callback granted *watcher_id* by "
304298":c:func:`PyDict_AddWatcher` will be called when *dict* is modified or "
@@ -307,7 +301,7 @@ msgstr ""
307301"将字典 *dict* 标记为已被监视。 由 :c:func:`PyDict_AddWatcher` 授权 *watcher_id* 对应的回调将在 "
308302"*dict* 被修改或释放时被调用。 成功时返回 ``0``,出错时返回 ``-1``。"
309303
310- #: ../../c-api/dict.rst:276
304+ #: ../../c-api/dict.rst:272
311305msgid ""
312306"Mark dictionary *dict* as no longer watched. The callback granted "
313307"*watcher_id* by :c:func:`PyDict_AddWatcher` will no longer be called when "
@@ -317,7 +311,7 @@ msgstr ""
317311"将字典 *dict* 标记为不再被监视。 由 :c:func:`PyDict_AddWatcher` 授权 *watcher_id* 对应的回调在 "
318312"*dict* 被修改或释放时将不再被调用。 该字典在此之前必须已被此监视器所监视。 成功时返回 ``0``,出错时返回 ``-1``。"
319313
320- #: ../../c-api/dict.rst:285
314+ #: ../../c-api/dict.rst:281
321315msgid ""
322316"Enumeration of possible dictionary watcher events: ``PyDict_EVENT_ADDED``, "
323317"``PyDict_EVENT_MODIFIED``, ``PyDict_EVENT_DELETED``, "
@@ -328,11 +322,11 @@ msgstr ""
328322"``PyDict_EVENT_DELETED``, ``PyDict_EVENT_CLONED``, ``PyDict_EVENT_CLEARED`` "
329323"或 ``PyDict_EVENT_DEALLOCATED``。"
330324
331- #: ../../c-api/dict.rst:293
325+ #: ../../c-api/dict.rst:289
332326msgid "Type of a dict watcher callback function."
333327msgstr "字典监视器回调函数的类型。"
334328
335- #: ../../c-api/dict.rst:295
329+ #: ../../c-api/dict.rst:291
336330msgid ""
337331"If *event* is ``PyDict_EVENT_CLEARED`` or ``PyDict_EVENT_DEALLOCATED``, both"
338332" *key* and *new_value* will be ``NULL``. If *event* is "
@@ -345,7 +339,7 @@ msgstr ""
345339"``PyDict_EVENT_MODIFIED``,则 *new_value* 将为 *key* 的新值。 如果 *event* 是 "
346340"``PyDict_EVENT_DELETED``,则将从字典中删除 *key* 而 *new_value* 将为 ``NULL``。"
347341
348- #: ../../c-api/dict.rst:301
342+ #: ../../c-api/dict.rst:297
349343msgid ""
350344"``PyDict_EVENT_CLONED`` occurs when *dict* was previously empty and another "
351345"dict is merged into it. To maintain efficiency of this operation, per-key "
@@ -355,7 +349,7 @@ msgstr ""
355349"``PyDict_EVENT_CLONED`` 会在另一个字典合并到之前为空的 *dict* 时发生。 为保证此操作的效率,该场景不会发出针对单个键的 "
356350"``PyDict_EVENT_ADDED`` 事件;而是发出单个 ``PyDict_EVENT_CLONED``,而 *key* 将为源字典。"
357351
358- #: ../../c-api/dict.rst:307
352+ #: ../../c-api/dict.rst:303
359353msgid ""
360354"The callback may inspect but must not modify *dict*; doing so could have "
361355"unpredictable effects, including infinite recursion. Do not trigger Python "
@@ -365,7 +359,7 @@ msgstr ""
365359"该回调可以检查但不能修改 *dict*;否则会产生不可预料的影响,包括无限递归。 请不要在该回调中触发 Python 代码的执行,因为它可能产生修改 "
366360"dict 的附带影响。"
367361
368- #: ../../c-api/dict.rst:311
362+ #: ../../c-api/dict.rst:307
369363msgid ""
370364"If *event* is ``PyDict_EVENT_DEALLOCATED``, taking a new reference in the "
371365"callback to the about-to-be-destroyed dictionary will resurrect it and "
@@ -377,13 +371,13 @@ msgstr ""
377371"``PyDict_EVENT_DEALLOCATED``,则在回调中接受一个对即将销毁的字典的新引用将使其重生并阻止其在此时被释放。 "
378372"当重生的对象以后再被销毁时,任何在当时已激活的监视器回调将再次被调用。"
379373
380- #: ../../c-api/dict.rst:317
374+ #: ../../c-api/dict.rst:313
381375msgid ""
382376"Callbacks occur before the notified modification to *dict* takes place, so "
383377"the prior state of *dict* can be inspected."
384378msgstr "回调会在已通知的对 *dict* 的修改完成之前执行,这样在此之前的 *dict* 状态可以被检查。"
385379
386- #: ../../c-api/dict.rst:320
380+ #: ../../c-api/dict.rst:316
387381msgid ""
388382"If the callback sets an exception, it must return ``-1``; this exception "
389383"will be printed as an unraisable exception using "
@@ -392,7 +386,7 @@ msgstr ""
392386"如果该回调设置了一个异常,则它必须返回 ``-1``;此异常将作为不可引发的异常使用 :c:func:`PyErr_WriteUnraisable` "
393387"打印出来。 在其他情况下它应当返回 ``0``。"
394388
395- #: ../../c-api/dict.rst:324
389+ #: ../../c-api/dict.rst:320
396390msgid ""
397391"There may already be a pending exception set on entry to the callback. In "
398392"this case, the callback should return ``0`` with the same exception still "
@@ -411,14 +405,10 @@ msgstr "object -- 对象"
411405msgid "dictionary"
412406msgstr "dictionary -- 字典"
413407
414- #: ../../c-api/dict.rst:73
415- msgid "PyUnicode_FromString()"
416- msgstr "PyUnicode_FromString()"
417-
418- #: ../../c-api/dict.rst:164
408+ #: ../../c-api/dict.rst:160
419409msgid "built-in function"
420410msgstr "内置函数"
421411
422- #: ../../c-api/dict.rst:164
412+ #: ../../c-api/dict.rst:160
423413msgid "len"
424414msgstr "len"
0 commit comments