4
4
#
5
5
# Translators:
6
6
# 周 忠毅 <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
7
10
msgid ""
8
11
msgstr ""
9
12
"Project-Id-Version : Python 3.11\n "
10
13
"Report-Msgid-Bugs-To : \n "
11
14
"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 "
14
17
"Language-Team : Chinese - TAIWAN (https://github.com/python/python-docs-zh- "
15
18
"tw)\n "
16
19
"Language : zh_TW\n "
@@ -161,18 +164,24 @@ msgid ""
161
164
"When writing time sensitive code using *bisect()* and *insort()*, keep these "
162
165
"thoughts in mind:"
163
166
msgstr ""
167
+ "若在需要關注寫入時間的程式當中使用 *bisect()* 和 *insort()*,請特別注意幾個事"
168
+ "項:"
164
169
165
170
#: ../../library/bisect.rst:113
166
171
msgid ""
167
172
"Bisection is effective for searching ranges of values. For locating specific "
168
173
"values, dictionaries are more performant."
169
174
msgstr ""
175
+ "二分法在一段範圍的數值中做搜索的效率較佳,但若是要存取特定數值,使用字典的表"
176
+ "現還是比較好。"
170
177
171
178
#: ../../library/bisect.rst:116
172
179
msgid ""
173
180
"The *insort()* functions are ``O(n)`` because the logarithmic search step is "
174
181
"dominated by the linear time insertion step."
175
182
msgstr ""
183
+ "*insort()* 函式的複雜度為 ``O(n)``,因為對數搜尋是以線性時間的插入步驟所主導 "
184
+ "(dominate)。"
176
185
177
186
#: ../../library/bisect.rst:119
178
187
msgid ""
@@ -184,13 +193,20 @@ msgid ""
184
193
"an array of precomputed keys to locate the insertion point (as shown in the "
185
194
"examples section below)."
186
195
msgstr ""
196
+ "搜索函式為無狀態的 (stateless),且鍵函式會在使用過後被丟棄。因此,如果搜索函"
197
+ "式被使用於迴圈當中,鍵函式會不斷被重複呼叫於相同的 list 元素。如果鍵函式執行"
198
+ "速度不快,請考慮將其以 :func:`functools.cache` 包裝起來以減少重複的計算。另"
199
+ "外,也可以透過搜尋預先計算好的鍵列表 (array of precomputed keys) 來定位插入點"
200
+ "(如下方範例所示)。"
187
201
188
202
#: ../../library/bisect.rst:129
189
203
msgid ""
190
204
"`Sorted Collections <https://grantjenks.com/docs/sortedcollections/>`_ is a "
191
205
"high performance module that uses *bisect* to managed sorted collections of "
192
206
"data."
193
207
msgstr ""
208
+ "`有序容器 (Sorted Collections) <https://grantjenks.com/docs/"
209
+ "sortedcollections/>`_ 是一個使用 *bisect* 來管理資料之有序集合的高效能模組。"
194
210
195
211
#: ../../library/bisect.rst:133
196
212
msgid ""
@@ -200,6 +216,10 @@ msgid ""
200
216
"keys are precomputed to save unnecessary calls to the key function during "
201
217
"searches."
202
218
msgstr ""
219
+ "`SortedCollection recipe <https://code.activestate.com/recipes/577197-"
220
+ "sortedcollection/>`_ 使用二分法來建立一個功能完整的集合類別 (collection "
221
+ "class) 並帶有符合直覺的搜索方法 (search methods) 與支援鍵函式。鍵會預先被計算"
222
+ "好,以減少搜索過程中多餘的鍵函式呼叫。"
203
223
204
224
#: ../../library/bisect.rst:141
205
225
msgid "Searching Sorted Lists"
@@ -212,6 +232,10 @@ msgid ""
212
232
"following five functions show how to transform them into the standard "
213
233
"lookups for sorted lists::"
214
234
msgstr ""
235
+ "上面的 :func:`bisect` 函式在找到數值插入點上很有用,但一般的數值搜尋任務上就"
236
+ "不是那麼的方便。以下的五個函式展示了如何將其轉換成標準的有序列表查找函式:\n"
237
+ "\n"
238
+ "::"
215
239
216
240
#: ../../library/bisect.rst:185
217
241
msgid "Examples"
@@ -224,16 +248,29 @@ msgid ""
224
248
"(say) based on a set of ordered numeric breakpoints: 90 and up is an 'A', 80 "
225
249
"to 89 is a 'B', and so on::"
226
250
msgstr ""
251
+ ":func:`bisect` 函式可用於數值表中的查找 (numeric table lookup),這個範例使"
252
+ "用 :func:`bisect` 以基於一組有序的數值分界點來為一個考試成績找到相對應的字母"
253
+ "等級:90 以上是 'A'、80 到 89 為 'B',依此類推:\n"
254
+ "\n"
255
+ "::"
227
256
228
257
#: ../../library/bisect.rst:201
229
258
msgid ""
230
259
"The :func:`bisect` and :func:`insort` functions also work with lists of "
231
260
"tuples. The *key* argument can serve to extract the field used for ordering "
232
261
"records in a table::"
233
262
msgstr ""
263
+ ":func:`bisect` 與 :func:`insort` 函式也適用於內容為 tuples(元組)的 lists,"
264
+ "*key* 引數可被用以取出在數值表中作為排序依據的欄位:\n"
265
+ "\n"
266
+ "::"
234
267
235
268
#: ../../library/bisect.rst:235
236
269
msgid ""
237
270
"If the key function is expensive, it is possible to avoid repeated function "
238
271
"calls by searching a list of precomputed keys to find the index of a record::"
239
272
msgstr ""
273
+ "如果鍵函式會消耗較多運算資源,那可以在預先計算好的鍵列表中搜索該紀錄的索引"
274
+ "值,以減少重複的函式呼叫:\n"
275
+ "\n"
276
+ "::"
0 commit comments