@@ -5089,58 +5089,64 @@ msgstr "返回原字典的浅拷贝。"
50895089#: ../../library/stdtypes.rst:4206
50905090msgid ""
50915091"Create a new dictionary with keys from *iterable* and values set to *value*."
5092- msgstr ""
5092+ msgstr "使用来自 *iterable* 的键创建一个新字典,并将键值设为 *value*。 "
50935093
50945094#: ../../library/stdtypes.rst:4208
50955095msgid ""
50965096":meth:`fromkeys` is a class method that returns a new dictionary. *value* "
50975097"defaults to ``None``."
5098- msgstr ""
5098+ msgstr ":meth:`fromkeys` 属于类方法,会返回一个新字典。 *value* 默认为 ``None``。 "
50995099
51005100#: ../../library/stdtypes.rst:4213
51015101msgid ""
51025102"Return the value for *key* if *key* is in the dictionary, else *default*. If"
51035103" *default* is not given, it defaults to ``None``, so that this method never "
51045104"raises a :exc:`KeyError`."
51055105msgstr ""
5106+ "如果 *key* 存在于字典中则返回 *key* 的值,否则返回 *default*。 如果 *default* 未给出则默认为 "
5107+ "``None``,因而此方法绝不会引发 :exc:`KeyError`。"
51065108
51075109#: ../../library/stdtypes.rst:4219
51085110msgid ""
51095111"Return a new view of the dictionary's items (``(key, value)`` pairs). See "
51105112"the :ref:`documentation of view objects <dict-views>`."
5111- msgstr ""
5113+ msgstr "返回由字典项 (``(键, 值)`` 对) 组成的一个新视图。 参见 :ref:`视图对象文档 <dict-views>`。 "
51125114
51135115#: ../../library/stdtypes.rst:4224
51145116msgid ""
51155117"Return a new view of the dictionary's keys. See the :ref:`documentation of "
51165118"view objects <dict-views>`."
5117- msgstr ""
5119+ msgstr "返回由字典键组成的一个新视图。 参见 :ref:`视图对象文档 <dict-views>`。 "
51185120
51195121#: ../../library/stdtypes.rst:4229
51205122msgid ""
51215123"If *key* is in the dictionary, remove it and return its value, else return "
51225124"*default*. If *default* is not given and *key* is not in the dictionary, a "
51235125":exc:`KeyError` is raised."
51245126msgstr ""
5127+ "如果 *key* 存在于字典中则将其移除并返回其值,否则返回 *default*。 如果 *default* 未给出且 *key* "
5128+ "不存在于字典中,则会引发 :exc:`KeyError`。"
51255129
51265130#: ../../library/stdtypes.rst:4235
51275131msgid ""
51285132"Remove and return a ``(key, value)`` pair from the dictionary. Pairs are "
51295133"returned in :abbr:`LIFO (last-in, first-out)` order."
5130- msgstr ""
5134+ msgstr "从字典中移除并返回一个 ``(键, 值)`` 对。 键值对会按 :abbr:`LIFO (后进先出)` 的顺序被返回。 "
51315135
51325136#: ../../library/stdtypes.rst:4238
51335137msgid ""
51345138":meth:`popitem` is useful to destructively iterate over a dictionary, as "
51355139"often used in set algorithms. If the dictionary is empty, calling "
51365140":meth:`popitem` raises a :exc:`KeyError`."
51375141msgstr ""
5142+ ":meth:`popitem` 适用于对字典进行消耗性的迭代,这在集合算法中经常被使用。 如果字典为空,调用 :meth:`popitem` 将引发 "
5143+ ":exc:`KeyError`。"
51385144
51395145#: ../../library/stdtypes.rst:4242
51405146msgid ""
51415147"LIFO order is now guaranteed. In prior versions, :meth:`popitem` would "
51425148"return an arbitrary key/value pair."
5143- msgstr ""
5149+ msgstr "现在会确保采用 LIFO 顺序。 在之前的版本中,:meth:`popitem` 会返回一个任意的键/值对。 "
51445150
51455151#: ../../library/stdtypes.rst:4248
51465152msgid ""
@@ -5154,7 +5160,7 @@ msgstr ""
51545160msgid ""
51555161"Update the dictionary with the key/value pairs from *other*, overwriting "
51565162"existing keys. Return ``None``."
5157- msgstr ""
5163+ msgstr "使用来自 *other* 的键/值对更新字典,覆盖原有的键。 返回 ``None``。 "
51585164
51595165#: ../../library/stdtypes.rst:4257
51605166msgid ""
@@ -5163,41 +5169,45 @@ msgid ""
51635169"arguments are specified, the dictionary is then updated with those key/value"
51645170" pairs: ``d.update(red=1, blue=2)``."
51655171msgstr ""
5172+ ":meth:`update` 接受另一个字典对象,或者一个包含键/值对(以长度为二的元组或其他可迭代对象表示)的可迭代对象。 "
5173+ "如果给出了关键字参数,则会以其所指定的键/值对更新字典: ``d.update(red=1, blue=2)``。"
51665174
51675175#: ../../library/stdtypes.rst:4264
51685176msgid ""
51695177"Return a new view of the dictionary's values. See the :ref:`documentation "
51705178"of view objects <dict-views>`."
5171- msgstr ""
5179+ msgstr "返回由字典值组成的一个新视图。 参见 :ref:`视图对象文档 <dict-views>`。 "
51725180
51735181#: ../../library/stdtypes.rst:4267
51745182msgid ""
51755183"Dictionaries compare equal if and only if they have the same ``(key, "
51765184"value)`` pairs. Order comparisons ('<', '<=', '>=', '>') raise "
51775185":exc:`TypeError`."
51785186msgstr ""
5187+ "两个字典的比较当且仅当具有相同的 ``(键, 值)`` 对时才会相等。 顺序比较 ('<', '<=', '>=', '>') 会引发 "
5188+ ":exc:`TypeError`。"
51795189
51805190#: ../../library/stdtypes.rst:4271
51815191msgid ""
51825192"Dictionaries preserve insertion order. Note that updating a key does not "
51835193"affect the order. Keys added after deletion are inserted at the end. ::"
5184- msgstr ""
5194+ msgstr "字典会保留插入时的顺序。 请注意对键的更新不会影响顺序。 删除并再次添加的键将被插入到末尾。 :: "
51855195
51865196#: ../../library/stdtypes.rst:4289
51875197msgid ""
51885198"Dictionary order is guaranteed to be insertion order. This behavior was an "
51895199"implementation detail of CPython from 3.6."
5190- msgstr ""
5200+ msgstr "字典顺序会确保为插入顺序。 此行为是自 3.6 版开始的 CPython 实现细节。 "
51915201
51925202#: ../../library/stdtypes.rst:4294
51935203msgid ""
51945204":class:`types.MappingProxyType` can be used to create a read-only view of a "
51955205":class:`dict`."
5196- msgstr ""
5206+ msgstr ":class:`types.MappingProxyType` 可被用来创建一个 :class:`dict` 的只读视图。 "
51975207
51985208#: ../../library/stdtypes.rst:4301
51995209msgid "Dictionary view objects"
5200- msgstr ""
5210+ msgstr "字典视图对象 "
52015211
52025212#: ../../library/stdtypes.rst:4303
52035213msgid ""
@@ -5206,12 +5216,14 @@ msgid ""
52065216"dictionary's entries, which means that when the dictionary changes, the view"
52075217" reflects these changes."
52085218msgstr ""
5219+ "由 :meth:`dict.keys`, :meth:`dict.values` 和 :meth:`dict.items` 所返回的对象是 "
5220+ "*视图对象*。 该对象提供字典条目的一个动态视图,这意味着当字典改变时,视图也会相应改变。"
52095221
52105222#: ../../library/stdtypes.rst:4308
52115223msgid ""
52125224"Dictionary views can be iterated over to yield their respective data, and "
52135225"support membership tests:"
5214- msgstr ""
5226+ msgstr "字典视图可以被迭代以产生与其对应的数据,并支持成员检测: "
52155227
52165228#: ../../library/stdtypes.rst:4313
52175229msgid "Return the number of entries in the dictionary."
0 commit comments