Skip to content

Commit acbafbe

Browse files
authored
Merge pull request #329 from mattwang44/translate-library-bisect
feat: translate rest part of `library/bisect.po`
2 parents f135f83 + 376f6fc commit acbafbe

File tree

1 file changed

+39
-2
lines changed

1 file changed

+39
-2
lines changed

library/bisect.po

+39-2
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,16 @@
44
#
55
# Translators:
66
# 周 忠毅 <rilakcrc35@gmail.com>, 2016
7+
# Liang-Bo Wang <me@liang2.tw>, 2017
8+
# pertertc <petertc.chu@gmail.com>, 2022
9+
# Matt Wang <mattwang44@gmail.com>, 2022
710
msgid ""
811
msgstr ""
912
"Project-Id-Version: Python 3.11\n"
1013
"Report-Msgid-Bugs-To: \n"
1114
"POT-Creation-Date: 2022-09-26 00:21+0000\n"
12-
"PO-Revision-Date: 2022-08-27 16:41+0800\n"
13-
"Last-Translator: Liang-Bo Wang <me@liang2.tw>\n"
15+
"PO-Revision-Date: 2022-10-17 10:53+0800\n"
16+
"Last-Translator: Matt Wang <mattwang44@gmail.com>\n"
1417
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
1518
"tw)\n"
1619
"Language: zh_TW\n"
@@ -161,18 +164,24 @@ msgid ""
161164
"When writing time sensitive code using *bisect()* and *insort()*, keep these "
162165
"thoughts in mind:"
163166
msgstr ""
167+
"若在需要關注寫入時間的程式當中使用 *bisect()* 和 *insort()*,請特別注意幾個事"
168+
"項:"
164169

165170
#: ../../library/bisect.rst:113
166171
msgid ""
167172
"Bisection is effective for searching ranges of values. For locating specific "
168173
"values, dictionaries are more performant."
169174
msgstr ""
175+
"二分法在一段範圍的數值中做搜索的效率較佳,但若是要存取特定數值,使用字典的表"
176+
"現還是比較好。"
170177

171178
#: ../../library/bisect.rst:116
172179
msgid ""
173180
"The *insort()* functions are ``O(n)`` because the logarithmic search step is "
174181
"dominated by the linear time insertion step."
175182
msgstr ""
183+
"*insort()* 函式的複雜度為 ``O(n)``,因為對數搜尋是以線性時間的插入步驟所主導 "
184+
"(dominate)。"
176185

177186
#: ../../library/bisect.rst:119
178187
msgid ""
@@ -184,13 +193,20 @@ msgid ""
184193
"an array of precomputed keys to locate the insertion point (as shown in the "
185194
"examples section below)."
186195
msgstr ""
196+
"搜索函式為無狀態的 (stateless),且鍵函式會在使用過後被丟棄。因此,如果搜索函"
197+
"式被使用於迴圈當中,鍵函式會不斷被重複呼叫於相同的 list 元素。如果鍵函式執行"
198+
"速度不快,請考慮將其以 :func:`functools.cache` 包裝起來以減少重複的計算。另"
199+
"外,也可以透過搜尋預先計算好的鍵列表 (array of precomputed keys) 來定位插入點"
200+
"(如下方範例所示)。"
187201

188202
#: ../../library/bisect.rst:129
189203
msgid ""
190204
"`Sorted Collections <https://grantjenks.com/docs/sortedcollections/>`_ is a "
191205
"high performance module that uses *bisect* to managed sorted collections of "
192206
"data."
193207
msgstr ""
208+
"`有序容器 (Sorted Collections) <https://grantjenks.com/docs/"
209+
"sortedcollections/>`_ 是一個使用 *bisect* 來管理資料之有序集合的高效能模組。"
194210

195211
#: ../../library/bisect.rst:133
196212
msgid ""
@@ -200,6 +216,10 @@ msgid ""
200216
"keys are precomputed to save unnecessary calls to the key function during "
201217
"searches."
202218
msgstr ""
219+
"`SortedCollection recipe <https://code.activestate.com/recipes/577197-"
220+
"sortedcollection/>`_ 使用二分法來建立一個功能完整的集合類別 (collection "
221+
"class) 並帶有符合直覺的搜索方法 (search methods) 與支援鍵函式。鍵會預先被計算"
222+
"好,以減少搜索過程中多餘的鍵函式呼叫。"
203223

204224
#: ../../library/bisect.rst:141
205225
msgid "Searching Sorted Lists"
@@ -212,6 +232,10 @@ msgid ""
212232
"following five functions show how to transform them into the standard "
213233
"lookups for sorted lists::"
214234
msgstr ""
235+
"上面的 :func:`bisect` 函式在找到數值插入點上很有用,但一般的數值搜尋任務上就"
236+
"不是那麼的方便。以下的五個函式展示了如何將其轉換成標準的有序列表查找函式:\n"
237+
"\n"
238+
"::"
215239

216240
#: ../../library/bisect.rst:185
217241
msgid "Examples"
@@ -224,16 +248,29 @@ msgid ""
224248
"(say) based on a set of ordered numeric breakpoints: 90 and up is an 'A', 80 "
225249
"to 89 is a 'B', and so on::"
226250
msgstr ""
251+
":func:`bisect` 函式可用於數值表中的查找 (numeric table lookup),這個範例使"
252+
"用 :func:`bisect` 以基於一組有序的數值分界點來為一個考試成績找到相對應的字母"
253+
"等級:90 以上是 'A'、80 到 89 為 'B',依此類推:\n"
254+
"\n"
255+
"::"
227256

228257
#: ../../library/bisect.rst:201
229258
msgid ""
230259
"The :func:`bisect` and :func:`insort` functions also work with lists of "
231260
"tuples. The *key* argument can serve to extract the field used for ordering "
232261
"records in a table::"
233262
msgstr ""
263+
":func:`bisect` 與 :func:`insort` 函式也適用於內容為 tuples(元組)的 lists,"
264+
"*key* 引數可被用以取出在數值表中作為排序依據的欄位:\n"
265+
"\n"
266+
"::"
234267

235268
#: ../../library/bisect.rst:235
236269
msgid ""
237270
"If the key function is expensive, it is possible to avoid repeated function "
238271
"calls by searching a list of precomputed keys to find the index of a record::"
239272
msgstr ""
273+
"如果鍵函式會消耗較多運算資源,那可以在預先計算好的鍵列表中搜索該紀錄的索引"
274+
"值,以減少重複的函式呼叫:\n"
275+
"\n"
276+
"::"

0 commit comments

Comments
 (0)