@@ -46,8 +46,9 @@ msgid ""
4646"Simple lightweight unbounded function cache. Sometimes called `\" memoize\" "
4747"<https://en.wikipedia.org/wiki/Memoization>`_."
4848msgstr ""
49- "簡單的輕量級無界函式快取 (Simple lightweight unbounded function cache)。有時"
50- "稱之為 `\" memoize\" (記憶化) <https://en.wikipedia.org/wiki/Memoization>`_。"
49+ "簡單的輕量級無繫結函式快取 (Simple lightweight unbounded function cache)。有"
50+ "時稱之為 `\" memoize\" (記憶化) <https://en.wikipedia.org/wiki/"
51+ "Memoization>`_。"
5152
5253#: ../../library/functools.rst:34
5354msgid ""
@@ -90,8 +91,8 @@ msgid ""
9091"computed properties of instances that are otherwise effectively immutable."
9192msgstr ""
9293"將類別的一個方法轉換為屬性 (property),其值會計算一次,然後在實例的生命週期內"
93- "快取為普通屬性。類似 :func:`property`,但增加了快取機制。對於實質上幾乎是不可 "
94- "變 (immutable) 的實例,針對其需要繁重計算的屬性會很有用 。"
94+ "快取為普通屬性。類似 :func:`property`,但增加了快取機制。對於除使用該裝飾器的 "
95+ "屬性外實質上幾乎是不可變 (immutable) 的實例,針對其所需要繁重計算會很有用 。"
9596
9697#: ../../library/functools.rst:70 ../../library/functools.rst:142
9798#: ../../library/functools.rst:383
@@ -138,8 +139,9 @@ msgid ""
138139msgstr ""
139140"*cached_property* 無法防止多執行緒使用中可能出現的競爭條件 (race condition)。"
140141"getter 函式可以在同一個實例上運行多次,最後一次運行會設定快取的值。所以快取的"
141- "屬性最好是冪等的 (idempotent),或者在一個實例上運行多次不會有害。如果同步是必"
142- "要的,請在裝飾的 getter 函式內部或在快取的屬性存取周圍實作必要的鎖。"
142+ "屬性最好是冪等的 (idempotent),或者在一個實例上運行多次不會有害,就不會有問"
143+ "題。如果同步是必要的,請在裝飾的 getter 函式內部或在快取的屬性存取周圍實作必"
144+ "要的鎖。"
143145
144146#: ../../library/functools.rst:102
145147msgid ""
@@ -159,7 +161,7 @@ msgid ""
159161"``__slots__`` without including ``__dict__`` as one of the defined slots (as "
160162"such classes don't provide a ``__dict__`` attribute at all)."
161163msgstr ""
162- "此外,此裝飾器要求每個實例上的 ``__dict__`` 屬性是可變映射 (mutable "
164+ "此外,此裝飾器要求每個實例上的 ``__dict__`` 屬性是可變對映 (mutable "
163165"mapping)。這意味著它不適用於某些型別,例如元類別 (metaclass)(因為型別實例上"
164166"的 ``__dict__`` 屬性是類別命名空間的唯讀代理),以及那些指定 ``__slots__`` 而"
165167"不包含 ``__dict__`` 的型別作為有定義的插槽之一(因為此種類別根本不提供 "
@@ -173,7 +175,7 @@ msgid ""
173175"cache-method-calls` for more details on how this differs from :func:"
174176"`cached_property`."
175177msgstr ""
176- "如果可變映射不可用或需要金鑰共享以節省空間 ,則也可以透過在 :func:`lru_cache` "
178+ "如果可變對映不可用或需要金鑰共享以節省空間 ,則也可以透過在 :func:`lru_cache` "
177179"之上堆疊 :func:`property` 來實作類似於 :func:`cached_property` 的效果。請參閱"
178180"\\ :ref:`faq-cache-method-calls`\\ 以了解有關這與 :func:`cached_property` 間"
179181"不同之處的更多詳細資訊。"
@@ -203,7 +205,7 @@ msgstr ""
203205"將舊式比較函式轉換為\\ :term:`鍵函式 <key function>`,能與接受鍵函式的工具一"
204206"起使用(例如 :func:`sorted`、:func:`min`、:func:`max`、:func:`heapq."
205207"nlargest`、:func:`heapq.nsmallest`、:func:`itertools.groupby`)。此函式主要作"
206- "為轉換工具,用於自有支援使用比較函式的 Python 2 轉換成的程式。"
208+ "為轉換工具,用於從有支援使用比較函式的 Python 2 轉換成的程式。"
207209
208210#: ../../library/functools.rst:137
209211msgid ""
@@ -227,8 +229,8 @@ msgid ""
227229"*maxsize* most recent calls. It can save time when an expensive or I/O "
228230"bound function is periodically called with the same arguments."
229231msgstr ""
230- "裝飾器以記憶化可呼叫物件來包裝函式 ,最多可省去 *maxsize* 個最近的呼叫。當使用 "
231- "相同引數定期呼叫繁重的或 I/O 密集的函式時,它可以節省時間。"
232+ "以記憶化可呼叫物件來包裝函式的裝飾器 ,最多可省去 *maxsize* 個最近的呼叫。當使 "
233+ "用相同引數定期呼叫繁重的或 I/O 密集的函式時,它可以節省時間。"
232234
233235#: ../../library/functools.rst:166
234236msgid ""
@@ -245,8 +247,8 @@ msgid ""
245247"differ in their keyword argument order and may have two separate cache "
246248"entries."
247249msgstr ""
248- "不同的引數模式可以被認為是具有不同快取條目的呼叫 。例如,``f(a=1, b=2)`` 和 "
249- "``f(b=2, a=1)`` 的關鍵字引數順序不同,並且可能有兩個單獨的快取條目 。"
250+ "不同的引數模式可以被認為是具有不同快取條目的不同呼叫 。例如,``f(a=1, b=2)`` "
251+ "和 ``f(b=2, a=1)`` 的關鍵字引數順序不同,並且可能有兩個不同的快取條目 。"
250252
251253#: ../../library/functools.rst:174
252254msgid ""
@@ -363,9 +365,9 @@ msgid ""
363365"objects on each call (such as generators and async functions), or impure "
364366"functions such as time() or random()."
365367msgstr ""
366- "一般來說,僅當你想要重複使用先前計算的值時才應使用 LRU 快取。因此,快取具有副 "
367- "作用的函式 、需要在每次呼叫時建立不同可變物件的函式(例如產生器和非同步函式) "
368- "或不純函式(impure function,例如 time() 或 random())是沒有意義的。"
368+ "一般來說,僅當你想要重複使用先前計算的值時才應使用 LRU 快取。因此,快取具有 "
369+ "side-effects 的函式 、需要在每次呼叫時建立不同可變物件的函式(例如產生器和非同 "
370+ "步函式) 或不純函式(impure function,例如 time() 或 random())是沒有意義的。"
369371
370372#: ../../library/functools.rst:233
371373msgid "Example of an LRU cache for static web content::"
@@ -409,7 +411,7 @@ msgid ""
409411"method."
410412msgstr ""
411413"類別必須定義 :meth:`__lt__`、:meth:`__le__`、:meth:`__gt__` 或 :meth:"
412- "`__ge__` 之一 。此外,該類別應該提供 :meth:`__eq__` 方法。"
414+ "`__ge__` 其中之一 。此外,該類別應該提供 :meth:`__eq__` 方法。"
413415
414416#: ../../library/functools.rst:311
415417msgid ""
@@ -420,9 +422,9 @@ msgid ""
420422"rich comparison methods instead is likely to provide an easy speed boost."
421423msgstr ""
422424"雖然此裝飾器可以輕鬆建立能好好運作的完全有序型別 (totally ordered types),但"
423- "它\\ *確實 *\\ 以衍生比較方法的執行速度較慢和堆疊追蹤 (stack trace) 較複雜為代 "
424- "價 。如果效能基準測試顯示這是給定應用程式的效能瓶頸,那麼實作全部六種 rich "
425- "comparison 方法通常能輕鬆地提升速度。"
425+ "它\\ *的確 *\\ 以衍生比較方法的執行速度較慢和堆疊追蹤 (stack trace) 較複雜做為 "
426+ "其代價 。如果效能基準測試顯示這是給定應用程式的效能瓶頸,那麼實作全部六種 "
427+ "rich comparison 方法通常能輕鬆地提升速度。"
426428
427429#: ../../library/functools.rst:320
428430msgid ""
@@ -439,7 +441,7 @@ msgstr ""
439441msgid ""
440442"Returning ``NotImplemented`` from the underlying comparison function for "
441443"unrecognised types is now supported."
442- msgstr "現在支援從底層對於未識別型別的比較函式回傳 NotImplemented。"
444+ msgstr "現在支援從底層對於未識別型別的比較函式回傳 `` NotImplemented`` 。"
443445
444446#: ../../library/functools.rst:333
445447msgid ""
@@ -449,9 +451,9 @@ msgid ""
449451"appended to *args*. If additional keyword arguments are supplied, they "
450452"extend and override *keywords*. Roughly equivalent to::"
451453msgstr ""
452- "回傳一個新的 :ref:`partial 物件 <partial-objects>`,它在呼叫時的行為類似於使 "
453- "用位置引數 *args* 和關鍵字引數 *keywords* 呼叫的 *func*。如果向呼叫提供更多引 "
454- "數 ,它們將被附加到 *args*。如果提供了額外的關鍵字引數,它們會擴充並覆寫 "
454+ "回傳一個新的 :ref:`partial 物件 <partial-objects>`,它在被呼叫時的行為類似於 "
455+ "使用位置引數 *args* 和關鍵字引數 *keywords* 呼叫的 *func*。如果向呼叫提供更多 "
456+ "引數 ,它們將被附加到 *args*。如果提供了額外的關鍵字引數,它們會擴充並覆寫 "
455457"*keywords*。大致相當於: ::"
456458
457459#: ../../library/functools.rst:349
@@ -493,8 +495,8 @@ msgid ""
493495msgstr ""
494496"當 *func* 是描述器時(例如普通的 Python 函式、:func:`classmethod`、:func:"
495497"`staticmethod`、:func:`abstractmethod` 或 :class:`partialmethod` 的另一個實"
496- "例),``__get__`` 的呼叫將被委託 (delegated) 給底層描述器,且一個適當的 :ref :"
497- "`partial 物件 <partial-objects>`\\ 會被作為結果回傳。"
498+ "例),對 ``__get__`` 的呼叫將被委託 (delegated) 給底層描述器,且一個適當的 :"
499+ "ref: `partial 物件 <partial-objects>`\\ 會被作為結果回傳。"
498500
499501#: ../../library/functools.rst:377
500502msgid ""
@@ -505,9 +507,9 @@ msgid ""
505507"`partialmethod` constructor."
506508msgstr ""
507509"當 *func* 是非描述器可呼叫物件 (non-descriptor callable) 時,會動態建立適當的"
508- "繫結方法 (bound method)。當用作方法時 ,其行為類似於普通的 Python 函式:"
509- "*self* 引數將作為第一個位置引數插入,會在提供給 :class:`partialmethod` 建構函 "
510- "式的 *args* 和 *keywords* 之前 。"
510+ "繫結方法 (bound method)。當被作為方法使用時 ,其行為類似於普通的 Python 函式:"
511+ "*self* 引數將作為第一個位置引數插入,甚至會在提供給 :class:`partialmethod` 建 "
512+ "構函式的 *args* 和 *keywords* 的前面 。"
511513
512514#: ../../library/functools.rst:408
513515msgid ""
@@ -526,7 +528,7 @@ msgstr ""
526528"算出 ``((((1+2)+3)+4)+5)``。左邊的引數 *x* 是累積值,右邊的引數 *y* 是來自 "
527529"*iterable* 的更新值。如果可選的 *initializer* 存在,則在計算中會將其放置在可"
528530"疊代物件的項目之前,並在可疊代物件為空時作為預設值。如果未給定 *initializer* "
529- "且 *iterable* 僅包含一個項目,則傳回第一個項目 。"
531+ "且 *iterable* 僅包含一個項目,則回傳第一個項目 。"
530532
531533#: ../../library/functools.rst:417
532534msgid "Roughly equivalent to::"
@@ -565,7 +567,7 @@ msgid ""
565567"functions annotated with types, the decorator will infer the type of the "
566568"first argument automatically::"
567569msgstr ""
568- "若要為函式新增重載實作 ,請使用泛型函式的 :func:`register` 屬性,該屬性可用作"
570+ "若要為函式新增過載實作 ,請使用泛型函式的 :func:`register` 屬性,該屬性可用作"
569571"裝飾器。對於以型別來註釋的函式,裝飾器將自動推斷第一個引數的型別: ::"
570572
571573#: ../../library/functools.rst:466
@@ -675,10 +677,10 @@ msgid ""
675677"Here is the ``Negator`` class with the ``neg`` methods bound to the class, "
676678"rather than an instance of the class::"
677679msgstr ""
678- "``@singledispatchmethod`` 支援與其他裝飾器嵌套 (nest ),例如 :func:"
679- "`@classmethod<classmethod>`。請注意,為了允許 ``dispatcher.register``,"
680- "``singledispatchmethod`` 必須是\\ *最外面的*\\ 裝飾器。這是 ``Negator`` 類 "
681- "別 ,其 ``neg`` 方法繫結到該類別,而不是該類別的實例: ::"
680+ "``@singledispatchmethod`` 支援與其他裝飾器巢狀使用 (nesting ),例如 :func:"
681+ "`@classmethod<classmethod>`。請注意,為了使 ``dispatcher.register`` 可用 ,"
682+ "``singledispatchmethod`` 必須是\\ *最外面的*\\ 裝飾器。以下範例是 "
683+ "``Negator`` 類別 ,其 ``neg`` 方法繫結到該類別,而不是該類別的實例: ::"
682684
683685#: ../../library/functools.rst:632
684686msgid ""
@@ -706,7 +708,7 @@ msgstr ""
706708"始函式的哪些屬性直接賦值給包裝函式上的匹配屬性,以及包裝函式的哪些屬性使用原"
707709"始函式中的對應屬性進行更新。這些引數的預設值是模組層級的常數 "
708710"``WRAPPER_ASSIGNMENTS``\\ (它賦值給包裝函式的 ``__module__``、``__name__``、"
709- "``__qualname__``、``__annotations__`` 和 ``__doc__`` 文件字串 (docstring))和 "
711+ "``__qualname__``、``__annotations__`` 和 ``__doc__`` 文件字串 (docstring)和 "
710712"``WRAPPER_UPDATES``\\ (更新包裝器函式的 ``__dict__``,即實例字典)。"
711713
712714#: ../../library/functools.rst:652
@@ -716,9 +718,9 @@ msgid ""
716718"this function automatically adds a ``__wrapped__`` attribute to the wrapper "
717719"that refers to the function being wrapped."
718720msgstr ""
719- "為了允許出於自我檢查和其他目的所對原始函式的存取(例如繞過快取裝飾器,如 : "
720- "func:`lru_cache`),此函式會自動向包裝器新增 ``__wrapped__`` 屬性,該包裝器參 "
721- "照被包裝的函式 。"
721+ "為了允許出於內省 (introspection) 和其他目的所對原始函式的存取(例如繞過快取裝 "
722+ "飾器,如 : func:`lru_cache`),此函式會自動向包裝器新增 ``__wrapped__`` 屬性,"
723+ "該包裝器參照被包裝的函式 。"
722724
723725#: ../../library/functools.rst:657
724726msgid ""
0 commit comments