@@ -132,28 +132,30 @@ msgid ""
132132"Next, it runs the :meth:`insert` method on *a* to insert *x* at the "
133133"appropriate position to maintain sort order."
134134msgstr ""
135+ "此函数首先会运行 :func:`bisect_right` 来定位一个插入点。 然后,它会在 *a* 上运行 :meth:`insert` "
136+ "方法在正确的位置插入 *x* 以保持排序顺序。"
135137
136138#: ../../library/bisect.rst:104
137139msgid "Performance Notes"
138- msgstr ""
140+ msgstr "性能说明 "
139141
140142#: ../../library/bisect.rst:106
141143msgid ""
142144"When writing time sensitive code using *bisect()* and *insort()*, keep these"
143145" thoughts in mind:"
144- msgstr ""
146+ msgstr "当使用 *bisect()* 和 *insort()* 编写时间敏感的代码时,请记住以下概念。 "
145147
146148#: ../../library/bisect.rst:109
147149msgid ""
148150"Bisection is effective for searching ranges of values. For locating specific"
149151" values, dictionaries are more performant."
150- msgstr ""
152+ msgstr "二分法对于搜索一定范围的值是很高效的。 对于定位特定的值,则字典的性能更好。 "
151153
152154#: ../../library/bisect.rst:112
153155msgid ""
154156"The *insort()* functions are ``O(n)`` because the logarithmic search step is"
155157" dominated by the linear time insertion step."
156- msgstr ""
158+ msgstr "*insort()* 函数的时间复杂度为 ``O(n)`` 因为对数时间的搜索步骤被线性时间的插入步骤所主导。 "
157159
158160#: ../../library/bisect.rst:115
159161msgid ""
@@ -165,13 +167,18 @@ msgid ""
165167"consider searching an array of precomputed keys to locate the insertion "
166168"point (as shown in the examples section below)."
167169msgstr ""
170+ "这些搜索函数都是无状态的并且会在它们被使用后丢弃键函数的结果。 因此,如果在一个循环中使用搜索函数,则键函数可能会在同一个数据元素上被反复调用。 "
171+ "如果键函数速度不快,请考虑用 :func:`functools.cache` 来包装它以避免重复计算。 "
172+ "另外,也可以考虑搜索一个预先计算好的键数组来定位插入点(如下面的示例节所演示的)。"
168173
169174#: ../../library/bisect.rst:125
170175msgid ""
171176"`Sorted Collections <http://www.grantjenks.com/docs/sortedcollections/>`_ is"
172177" a high performance module that uses *bisect* to managed sorted collections "
173178"of data."
174179msgstr ""
180+ "`Sorted Collections <http://www.grantjenks.com/docs/sortedcollections/>`_ "
181+ "是一个使用 *bisect* 来管理数据的已排序多项集的高性能模块。"
175182
176183#: ../../library/bisect.rst:129
177184msgid ""
@@ -181,6 +188,9 @@ msgid ""
181188"search methods and support for a key-function. The keys are precomputed to "
182189"save unnecessary calls to the key function during searches."
183190msgstr ""
191+ "`SortedCollection recipe "
192+ "<https://code.activestate.com/recipes/577197-sortedcollection/>`_ 使用 bisect "
193+ "构建了一个功能完整的多项集类,拥有直观的搜索方法和对键函数的支持。 所有键函数都 是预先计算好的以避免在搜索期间对键函数的不必要的调用。"
184194
185195#: ../../library/bisect.rst:137
186196msgid "Searching Sorted Lists"
@@ -214,4 +224,4 @@ msgstr ""
214224msgid ""
215225"One technique to avoid repeated calls to a key function is to search a list "
216226"of precomputed keys to find the index of a record::"
217- msgstr ""
227+ msgstr "一种避免重复调用键函数的技巧是搜索一个预先计算好的键函数列表来找出记录的索引:: "
0 commit comments