From 3731d76a4c9173a92b3858c0ca677ec7f7994385 Mon Sep 17 00:00:00 2001 From: "Matt.Wang" Date: Mon, 17 Oct 2022 00:37:39 +0800 Subject: [PATCH] feat: translate rest part of `library/bisect.po` --- library/bisect.po | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/library/bisect.po b/library/bisect.po index 5152f08340..ca4b453ee7 100644 --- a/library/bisect.po +++ b/library/bisect.po @@ -4,13 +4,16 @@ # # Translators: # 周 忠毅 , 2016 +# Liang-Bo Wang , 2017 +# pertertc , 2022 +# Matt Wang , 2022 msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2022-09-26 00:21+0000\n" -"PO-Revision-Date: 2022-08-27 16:41+0800\n" -"Last-Translator: Liang-Bo Wang \n" +"PO-Revision-Date: 2022-10-17 10:53+0800\n" +"Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" "Language: zh_TW\n" @@ -161,18 +164,24 @@ msgid "" "When writing time sensitive code using *bisect()* and *insort()*, keep these " "thoughts in mind:" msgstr "" +"若在需要關注寫入時間的程式當中使用 *bisect()* 和 *insort()*,請特別注意幾個事" +"項:" #: ../../library/bisect.rst:113 msgid "" "Bisection is effective for searching ranges of values. For locating specific " "values, dictionaries are more performant." msgstr "" +"二分法在一段範圍的數值中做搜索的效率較佳,但若是要存取特定數值,使用字典的表" +"現還是比較好。" #: ../../library/bisect.rst:116 msgid "" "The *insort()* functions are ``O(n)`` because the logarithmic search step is " "dominated by the linear time insertion step." msgstr "" +"*insort()* 函式的複雜度為 ``O(n)``,因為對數搜尋是以線性時間的插入步驟所主導 " +"(dominate)。" #: ../../library/bisect.rst:119 msgid "" @@ -184,6 +193,11 @@ msgid "" "an array of precomputed keys to locate the insertion point (as shown in the " "examples section below)." msgstr "" +"搜索函式為無狀態的 (stateless),且鍵函式會在使用過後被丟棄。因此,如果搜索函" +"式被使用於迴圈當中,鍵函式會不斷被重複呼叫於相同的 list 元素。如果鍵函式執行" +"速度不快,請考慮將其以 :func:`functools.cache` 包裝起來以減少重複的計算。另" +"外,也可以透過搜尋預先計算好的鍵列表 (array of precomputed keys) 來定位插入點" +"(如下方範例所示)。" #: ../../library/bisect.rst:129 msgid "" @@ -191,6 +205,8 @@ msgid "" "high performance module that uses *bisect* to managed sorted collections of " "data." msgstr "" +"`有序容器 (Sorted Collections) `_ 是一個使用 *bisect* 來管理資料之有序集合的高效能模組。" #: ../../library/bisect.rst:133 msgid "" @@ -200,6 +216,10 @@ msgid "" "keys are precomputed to save unnecessary calls to the key function during " "searches." msgstr "" +"`SortedCollection recipe `_ 使用二分法來建立一個功能完整的集合類別 (collection " +"class) 並帶有符合直覺的搜索方法 (search methods) 與支援鍵函式。鍵會預先被計算" +"好,以減少搜索過程中多餘的鍵函式呼叫。" #: ../../library/bisect.rst:141 msgid "Searching Sorted Lists" @@ -212,6 +232,10 @@ msgid "" "following five functions show how to transform them into the standard " "lookups for sorted lists::" msgstr "" +"上面的 :func:`bisect` 函式在找到數值插入點上很有用,但一般的數值搜尋任務上就" +"不是那麼的方便。以下的五個函式展示了如何將其轉換成標準的有序列表查找函式:\n" +"\n" +"::" #: ../../library/bisect.rst:185 msgid "Examples" @@ -224,6 +248,11 @@ msgid "" "(say) based on a set of ordered numeric breakpoints: 90 and up is an 'A', 80 " "to 89 is a 'B', and so on::" msgstr "" +":func:`bisect` 函式可用於數值表中的查找 (numeric table lookup),這個範例使" +"用 :func:`bisect` 以基於一組有序的數值分界點來為一個考試成績找到相對應的字母" +"等級:90 以上是 'A'、80 到 89 為 'B',依此類推:\n" +"\n" +"::" #: ../../library/bisect.rst:201 msgid "" @@ -231,9 +260,17 @@ msgid "" "tuples. The *key* argument can serve to extract the field used for ordering " "records in a table::" msgstr "" +":func:`bisect` 與 :func:`insort` 函式也適用於內容為 tuples(元組)的 lists," +"*key* 引數可被用以取出在數值表中作為排序依據的欄位:\n" +"\n" +"::" #: ../../library/bisect.rst:235 msgid "" "If the key function is expensive, it is possible to avoid repeated function " "calls by searching a list of precomputed keys to find the index of a record::" msgstr "" +"如果鍵函式會消耗較多運算資源,那可以在預先計算好的鍵列表中搜索該紀錄的索引" +"值,以減少重複的函式呼叫:\n" +"\n" +"::"