10000 Sync with CPython 3.10 by pydoc-zh-tw[bot] · Pull Request #255 · python/python-docs-zh-tw · GitHub
[go: up one dir, main page]

Skip to content

Sync with CPython 3.10 #255

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

8000
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
130 changes: 87 additions & 43 deletions library/collections.po
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Python 3.10\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-02-20 00:14+0000\n"
"PO-Revision-Date: 2022-02-07 11:41+0800\n"
"POT-Creation-Date: 2022-02-26 00:11+0000\n"
"PO-Revision-Date: 2022-03-01 01:14+0800\n"
"Last-Translator: Matt Wang <mattwang44@gmail.com>\n"
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
"tw)\n"
Expand Down Expand Up @@ -964,7 +964,7 @@ msgstr ""
"此屬性為 :meth:`__missing__` 方法所使用。如果有引數被傳入建構函式,則此屬性會"
"被初始化成第一個引數,如未提供引數則被初始化為 ``None``。"

#: ../../library/collections.rst:764 ../../library/collections.rst:1163
#: ../../library/collections.rst:764 ../../library/collections.rst:1180
msgid ""
"Added merge (``|``) and update (``|=``) operators, specified in :pep:`584`."
msgstr "新增合併 (``|``) 和更新 (``|=``) 運算子,請見 :pep:`584`。"
Expand Down Expand Up @@ -1340,48 +1340,92 @@ msgstr ""

#: ../../library/collections.rst:1095
msgid ""
"Algorithmically, :class:`OrderedDict` can handle frequent reordering "
"operations better than :class:`dict`. This makes it suitable for tracking "
"recent accesses (for example in an `LRU cache <https://medium.com/"
"@krishankantsinghal/my-first-blog-on-medium-583159139237>`_)."
"The :class:`OrderedDict` algorithm can handle frequent reordering operations "
"better than :class:`dict`. As shown in the recipes below, this makes it "
"suitable for implementing various kinds of LRU caches."
msgstr ""
"在演算法中,\\ :class:`OrderedDict` 比起 :class:`dict` 更適合處理頻繁的重新排"
"序操作,這讓它適合用於追蹤近期存取紀錄(例如用於 `LRU cache <https://medium."
"com/@krishankantsinghal/my-first-blog-on-medium-583159139237>`_)。"
":class:`OrderedDict` 比起 :class:`dict` 更適合處理頻繁的重新排序操作,如在下"
"方用法中所示,這讓它適合用於多種 LRU cache 的實作中。"

#: ../../library/collections.rst:1100
#: ../../library/collections.rst:1099
msgid ""
"The equality operation for :class:`OrderedDict` checks for matching order."
msgstr ":class:`OrderedDict` 之相等性運算會檢查順序是否相同。"

#: ../../library/collections.rst:1102
#: ../../library/collections.rst:1101
msgid ""
"A regular :class:`dict` can emulate the order sensitive equality test with "
"``p == q and all(k1 == k2 for k1, k2 in zip(p, q))``."
msgstr ""
"一個一般的 :class:`dict` 可以用 ``p == q and all(k1 == k2 for k1, k2 in "
"zip(p, q))`` 來效仿有檢查順序的相等性運算。"

#: ../../library/collections.rst:1104
msgid ""
"The :meth:`popitem` method of :class:`OrderedDict` has a different "
"signature. It accepts an optional argument to specify which item is popped."
msgstr ""
":class:`OrderedDict` 類別的 :meth:`popitem` 方法有不同的函數簽名 "
"(signature),它接受傳入一個選擇性引數來指定要移除哪個元素。"

#: ../../library/collections.rst:1105
#: ../../library/collections.rst:1107
msgid ""
"A regular :class:`dict` can emulate OrderedDict's ``od.popitem(last=True)`` "
"with ``d.popitem()`` which is guaranteed to pop the rightmost (last) item."
msgstr ""
"一個一般的 :class:`dict` 可以用 ``d.popitem()`` 來效仿 OrderedDict 的 ``od."
"popitem(last=True)``\\ ,這保證會移除最右邊(最後一個)的元素。"

#: ../../library/collections.rst:1110
msgid ""
"A regular :class:`dict` can emulate OrderedDict's ``od.popitem(last=False)`` "
"with ``(k := next(iter(d)), d.pop(k))`` which will return and remove the "
"leftmost (first) item if it exists."
msgstr ""
"一個一般的 :class:`dict` 可以用 ``(k := next(iter(d)), d.pop(k))`` 來效仿 "
"OrderedDict 的 ``od.popitem(last=False)``\\ ,若最左邊(第一個)的元素存在,"
"則將其回傳並移除。"

#: ../../library/collections.rst:1114
msgid ""
":class:`OrderedDict` has a :meth:`move_to_end` method to efficiently "
"reposition an element to an endpoint."
msgstr ""
":class:`OrderedDict` 有個 :meth:`move_to_end` 方法可有效率地將一個元素重新排"
"列到任一端。"

#: ../../library/collections.rst:1108
#: ../../library/collections.rst:1117
msgid ""
"A regular :class:`dict` can emulate OrderedDict's ``od.move_to_end(k, "
"last=True)`` with ``d[k] = d.pop(k)`` which will move the key and its "
"associated value to the rightmost (last) position."
msgstr ""
"一個一般的 :class:`dict` 可以用 ``d[k] = d.pop(k)`` 來效仿 OrderedDict 的 "
"``od.move_to_end(k, last=True)``\\ ,這會將該鍵與其對應到的值移動至最右(最後"
"面)的位置。"

#: ../../library/collections.rst:1121
msgid ""
"A regular :class:`dict` does not have an efficient equivalent for "
"OrderedDict's ``od.move_to_end(k, last=False)`` which moves the key and its "
"associated value to the leftmost (first) position."
msgstr ""
"一個一般的 :class:`dict` 沒有和 OrderedDict 的 ``od.move_to_end(k, "
"last=False)`` 等價的有效方式,這是將鍵與其對應到的值移動至最左(最前面)位置"
"的方法。"

#: ../../library/collections.rst:1125
msgid "Until Python 3.8, :class:`dict` lacked a :meth:`__reversed__` method."
msgstr "在 Python 3.8 之前,:class:`dict` 並沒有 :meth:`__reversed__` 方法。"

#: ../../library/collections.rst:1113
#: ../../library/collections.rst:1130
msgid ""
"Return an instance of a :class:`dict` subclass that has methods specialized "
"for rearranging dictionary order."
msgstr ""
"回傳一個 :class:`dict` 子類別的實例,它具有專門用於重新排列字典順序的方法。"

#: ../../library/collections.rst:1120
#: ../../library/collections.rst:1137
msgid ""
"The :meth:`popitem` method for ordered dictionaries returns and removes a "
"(key, value) pair. The pairs are returned in :abbr:`LIFO (last-in, first-"
Expand All @@ -1393,7 +1437,7 @@ msgstr ""
"回傳鍵值對,否則就按 :abbr:`FIFO (first-in, first-out)` 先進先出的順序回傳鍵"
"值對。"

#: ../../library/collections.rst:1127
#: ../../library/collections.rst:1144
msgid ""
"Move an existing *key* to either end of an ordered dictionary. The item is "
"moved to the right end if *last* is true (the default) or to the beginning "
Expand All @@ -1403,15 +1447,15 @@ msgstr ""
"設值)則將元素移至右端;如果 *last* 為假值則將元素移至左端。如果 *key* 不存在"
"則會引發 :exc:`KeyError`:"

#: ../../library/collections.rst:1144
#: ../../library/collections.rst:1161
msgid ""
"In addition to the usual mapping methods, ordered dictionaries also support "
"reverse iteration using :func:`reversed`."
msgstr ""
"除了普通的對映方法,ordered dictionary 還支援了透過 :func:`reversed` 來做倒序"
"疊代。"

#: ../../library/collections.rst:1147
#: ../../library/collections.rst:1164
msgid ""
"Equality tests between :class:`OrderedDict` objects are order-sensitive and "
"are implemented as ``list(od1.items())==list(od2.items())``. Equality tests "
Expand All @@ -1425,27 +1469,27 @@ msgstr ""
"和其他 :class:`~collections.abc.Mapping` 物件間的相等性運算則像普通字典一樣不"
"考慮順序性,這使得 :class:`OrderedDict` 可於任何字典可使用的時機中被替換掉。"

#: ../../library/collections.rst:1154
#: ../../library/collections.rst:1171
msgid ""
"The items, keys, and values :term:`views <dictionary view>` of :class:"
"`OrderedDict` now support reverse iteration using :func:`reversed`."
msgstr ""
":class:`OrderedDict` 的項 (item)、鍵與值之\\ :term:`視圖 <dictionary view>`"
"\\ 現在可透過 :func:`reversed` 來倒序疊代。"

#: ../../library/collections.rst:1158
#: ../../library/collections.rst:1175
msgid ""
"With the acceptance of :pep:`468`, order is retained for keyword arguments "
"passed to the :class:`OrderedDict` constructor and its :meth:`update` method."
msgstr ""
"隨著 :pep:`468` 被核可,被傳入給 :class:`OrderedDict` 建構函式與其 :meth:"
"`update` 方法的關鍵字引數之順序被保留了下來。"

#: ../../library/collections.rst:1168
#: ../../library/collections.rst:1185
msgid ":class:`OrderedDict` Examples and Recipes"
msgstr ":class:`OrderedDict` 範例與用法"

#: ../../library/collections.rst:1170
#: ../../library/collections.rst:1187
msgid ""
"It is straightforward to create an ordered dictionary variant that remembers "
"the order the keys were *last* inserted. If a new entry overwrites an "
Expand All @@ -1457,19 +1501,19 @@ msgstr ""
"\n"
"::"

#: ../../library/collections.rst:1182
#: ../../library/collections.rst:1199
msgid ""
"An :class:`OrderedDict` would also be useful for implementing variants of :"
"func:`functools.lru_cache`:"
msgstr ""
":class:`OrderedDict` 在實現一個 :func:`functools.lru_cache` 的變形版本時也非"
"常有用:"

#: ../../library/collections.rst:1280
#: ../../library/collections.rst:1297
msgid ":class:`UserDict` objects"
msgstr ":class:`UserDict` 物件"

#: ../../library/collections.rst:1282
#: ../../library/collections.rst:1299
msgid ""
"The class, :class:`UserDict` acts as a wrapper around dictionary objects. "
"The need for this class has been partially supplanted by the ability to "
Expand All @@ -1480,7 +1524,7 @@ msgstr ""
"`dict` 建立子類別,這個類別的需求已部分被滿足,不過這個類別使用起來更方便,因"
"為被包裝的字典可以作為其屬性來存取。"

#: ../../library/collections.rst:1290
#: ../../library/collections.rst:1307
msgid ""
"Class that simulates a dictionary. The instance's contents are kept in a "
"regular dictionary, which is accessible via the :attr:`data` attribute of :"
Expand All @@ -1492,23 +1536,23 @@ msgstr ""
"`data` 屬性來做存取。如果有提供 *initialdata*\\ ,\\ :attr:`data` 屬性會被初"
"始化為其值;要注意指到 *initialdata* 的參照不會被保留,使其可被用於其他目的。"

#: ../../library/collections.rst:1296
#: ../../library/collections.rst:1313
msgid ""
"In addition to supporting the methods and operations of mappings, :class:"
"`UserDict` instances provide the following attribute:"
msgstr ""
"除了支援作為對映所需的方法與操作,\\ :class:`UserDict` 實例提供了以下屬性:"

#: ../../library/collections.rst:1301
#: ../../library/collections.rst:1318
msgid ""
"A real dictionary used to store the contents of the :class:`UserDict` class."
msgstr "一個真實的字典,用於儲存 :class:`UserDict` 類別的資料內容。"

#: ../../library/collections.rst:1307
#: ../../library/collections.rst:1324
msgid ":class:`UserList` objects"
msgstr ":class:`UserList` 物件"

#: ../../library/collections.rst:1309
#: ../../library/collections.rst:1326
msgid ""
"This class acts as a wrapper around list objects. It is a useful base class "
"for your own list-like classes which can inherit from them and override "
Expand All @@ -1519,7 +1563,7 @@ msgstr ""
"入新方法來定義你所需的一個類似於 list 的類別。如此一來,我們可以為 list 加入"
"新的特性。"

#: ../../library/collections.rst:1314
#: ../../library/collections.rst:1331
msgid ""
"The need for this class has been partially supplanted by the ability to "
"subclass directly from :class:`list`; however, this class can be easier to "
Expand All @@ -1528,7 +1572,7 @@ msgstr ""
"因為已經可以直接自 :class:`list` 建立子類別,這個類別的需求已部分被滿足,不過"
"這個類別使用起來更方便,因為被包裝的 list 可以作為其屬性來存取。"

#: ../../library/collections.rst:1320
#: ../../library/collections.rst:1337
msgid ""
"Class that simulates a list. The instance's contents are kept in a regular "
"list, which is accessible via the :attr:`data` attribute of :class:"
Expand All @@ -1541,21 +1585,21 @@ msgstr ""
"list ``[]``。\\ *list* 可以是任何 iterable,例如一個真實的 Python list 或是一"
"個 :class:`UserList` 物件。"

#: ../../library/collections.rst:1326
#: ../../library/collections.rst:1343
msgid ""
"In addition to supporting the methods and operations of mutable sequences, :"
"class:`UserList` instances provide the following attribute:"
msgstr ""
"除了支援可變序列的方法與操作,\\ :class:`UserList` 實例提供了以下屬性:"

#: ../../library/collections.rst:1331
#: ../../library/collections.rst:1348
msgid ""
"A real :class:`list` object used to store the contents of the :class:"
"`UserList` class."
msgstr ""
"一個真實的 :class:`list` 物件,用於儲存 :class:`UserList` 類別的資料內容。"

#: ../../library/collections.rst:1334
#: ../../library/collections.rst:1351
msgid ""
"**Subclassing requirements:** Subclasses of :class:`UserList` are expected "
"to offer a constructor which can be called with either no arguments or one "
Expand All @@ -1569,7 +1613,7 @@ msgstr ""
"例,為了達成上述目的,它假設建構函式可傳入單一參數來呼叫,該參數即是做為數據"
"來源的一個序列物件。"

#: ../../library/collections.rst:1341
#: ../../library/collections.rst:1358
msgid ""
"If a derived class does not wish to comply with this requirement, all of the "
"special methods supported by this class will need to be overridden; please "
Expand All @@ -1579,11 +1623,11 @@ msgstr ""
"如果希望一個自此獲得的子類別不遵從上述要求,那所有該類別支援的特殊方法則必須"
"被覆寫;請參考原始碼來理解在這情況下哪些方法是必須提供的。"

#: ../../library/collections.rst:1347
#: ../../library/collections.rst:1364
msgid ":class:`UserString` objects"
msgstr ":class:`UserString` 物件"

#: ../../library/collections.rst:1349
#: ../../library/collections.rst:1366
msgid ""
"The class, :class:`UserString` acts as a wrapper around string objects. The "
"need for this class has been partially supplanted by the ability to subclass "
Expand All @@ -1594,7 +1638,7 @@ msgstr ""
"建立子類別,這個類別的需求已經部分被滿足,不過這個類別使用起來更方便,因為被"
"包裝的字串可以作為其屬性來存取。"

#: ../../library/collections.rst:1357
#: ../../library/collections.rst:1374
msgid ""
"Class that simulates a string object. The instance's content is kept in a "
"regular string object, which is accessible via the :attr:`data` attribute "
Expand All @@ -1606,21 +1650,21 @@ msgstr ""
"的 :attr:`data` 屬性來做存取。實例內容被初始化為 *seq* 的複製,\\ *seq* 引數"
"可以是任何可被內建函式 :func:`str` 轉換成字串的物件。"

#: ../../library/collections.rst:1364
#: ../../library/collections.rst:1381
msgid ""
"In addition to supporting the methods and operations of strings, :class:"
"`UserString` instances provide the following attribute:"
msgstr ""
"除了支援字串的方法和操作以外,\\ :class:`UserString` 實例也提供了以下屬性:"

#: ../../library/collections.rst:1369
#: ../../library/collections.rst:1386
msgid ""
"A real :class:`str` object used to store the contents of the :class:"
"`UserString` class."
msgstr ""
"一個真實的 :class:`str` 物件,用來儲存 :class:`UserString` 類別的資料內容。"

#: ../../library/collections.rst:1372
#: ../../library/collections.rst:1389
msgid ""
"New methods ``__getnewargs__``, ``__rmod__``, ``casefold``, ``format_map``, "
"``isprintable``, and ``maketrans``."
Expand Down
Loading
0