diff --git a/howto/sorting.po b/howto/sorting.po index c61a7fc774..f66a0870ce 100644 --- a/howto/sorting.po +++ b/howto/sorting.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" -"PO-Revision-Date: 2023-08-12 15:09+0800\n" +"PO-Revision-Date: 2024-12-20 19:16+0800\n" "Last-Translator: Li-Hung Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -128,6 +128,8 @@ msgid "" ">>> sorted(\"This is a test string from Andrew\".split(), key=str.casefold)\n" "['a', 'Andrew', 'from', 'is', 'string', 'test', 'This']" msgstr "" +">>> sorted(\"This is a test string from Andrew\".split(), key=str.casefold)\n" +"['a', 'Andrew', 'from', 'is', 'string', 'test', 'This']" #: ../../howto/sorting.rst:61 msgid "" @@ -157,6 +159,13 @@ msgid "" ">>> sorted(student_tuples, key=lambda student: student[2]) # sort by age\n" "[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]" msgstr "" +">>> student_tuples = [\n" +"... ('john', 'A', 15),\n" +"... ('jane', 'B', 12),\n" +"... ('dave', 'B', 10),\n" +"... ]\n" +">>> sorted(student_tuples, key=lambda student: student[2]) # 依照年齡排序\n" +"[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]" #: ../../howto/sorting.rst:79 msgid "" @@ -182,6 +191,22 @@ msgid "" "age\n" "[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]" msgstr "" +">>> class Student:\n" +"... def __init__(self, name, grade, age):\n" +"... self.name = name\n" +"... self.grade = grade\n" +"... self.age = age\n" +"... def __repr__(self):\n" +"... return repr((self.name, self.grade, self.age))\n" +"\n" +">>> student_objects = [\n" +"... Student('john', 'A', 15),\n" +"... Student('jane', 'B', 12),\n" +"... Student('dave', 'B', 10),\n" +"... ]\n" +">>> sorted(student_objects, key=lambda student: student.age) # 依照年齡排" +"序\n" +"[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]" #: ../../howto/sorting.rst:99 msgid "" @@ -363,6 +388,10 @@ msgid "" "primary key, descending\n" "[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]" msgstr "" +">>> s = sorted(student_objects, key=attrgetter('age')) # 依照次要鍵排序\n" +">>> sorted(s, key=attrgetter('grade'), reverse=True) # 現在依照主要鍵降" +"冪排序\n" +"[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]" #: ../../howto/sorting.rst:193 msgid "" @@ -436,6 +465,11 @@ msgid "" ">>> [student for grade, i, student in decorated] # undecorate\n" "[('john', 'A', 15), ('jane', 'B', 12), ('dave', 'B', 10)]" msgstr "" +">>> decorated = [(student.grade, i, student) for i, student in " +"enumerate(student_objects)]\n" +">>> decorated.sort()\n" +">>> [student for grade, i, student in decorated] # 移除裝飾\n" +"[('john', 'A', 15), ('jane', 'B', 12), ('dave', 'B', 10)]" #: ../../howto/sorting.rst:231 msgid "" @@ -532,7 +566,7 @@ msgstr "" #: ../../howto/sorting.rst:273 msgid "sorted(words, key=cmp_to_key(strcoll)) # locale-aware sort order" -msgstr "" +msgstr "sorted(words, key=cmp_to_key(strcoll)) # 理解語系的排序順序" #: ../../howto/sorting.rst:276 msgid "Odds and Ends" @@ -605,10 +639,10 @@ msgid "" "six comparison methods be implemented. The :func:`~functools.total_ordering` " "decorator is provided to make that task easier." msgstr "" -"然而,請注意,當 :meth:`~object.__lt__` 沒有被實做時,``<`` 可以回退 (fall " +"然而,請注意,當 :meth:`~object.__lt__` 沒有被實作時,``<`` 可以回退 (fall " "back) 使用 :meth:`~object.__gt__`\\ (有關技術上的細節資訊請看 :func:`object." -"__lt__` )。為了避免意外發生,:pep:`8` 建議所有六種的比較函式都需要被實作。裝飾" -"器 :func:`~functools.total_ordering` 被提供用來讓任務更為簡單。" +"__lt__` )。為了避免意外發生,:pep:`8` 建議所有六種的比較函式都需要被實作。裝" +"飾器 :func:`~functools.total_ordering` 被提供用來讓任務更為簡單。" #: ../../howto/sorting.rst:314 msgid "" @@ -672,7 +706,6 @@ msgid "" "position ``0``. These functions are suitable for implementing priority " "queues which are commonly used for task scheduling." msgstr "" -":func:`heapq.heappush` 和 :func:`heapq.heappop` 會建立並維持一個部份排序的資料" -"排列,將最小的元素保持在位置 ``0``。這些函式適合用來實作常用於任務排程的優先" -"佇列。" - +":func:`heapq.heappush` 和 :func:`heapq.heappop` 會建立並維持一個部份排序的資" +"料排列,將最小的元素保持在位置 ``0``。這些函式適合用來實作常用於任務排程的優" +"先佇列。" diff --git a/library/enum.po b/library/enum.po index 25abbe8562..85b9d2908d 100644 --- a/library/enum.po +++ b/library/enum.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-11-02 00:13+0000\n" -"PO-Revision-Date: 2023-09-11 14:08+0800\n" +"PO-Revision-Date: 2024-12-21 13:50+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -85,6 +85,16 @@ msgid "" ">>> # functional syntax\n" ">>> Color = Enum('Color', [('RED', 1), ('GREEN', 2), ('BLUE', 3)])" msgstr "" +">>> from enum import Enum\n" +"\n" +">>> # class 語法\n" +">>> class Color(Enum):\n" +"... RED = 1\n" +"... GREEN = 2\n" +"... BLUE = 3\n" +"\n" +">>> # 函式語法\n" +">>> Color = Enum('Color', [('RED', 1), ('GREEN', 2), ('BLUE', 3)])" #: ../../library/enum.rst:49 msgid "" @@ -199,7 +209,7 @@ msgid "" "the :class:`str() ` of the mixed-in type." msgstr "" "由 :class:`IntEnum`、:class:`StrEnum` 及 :class:`IntFlag` 所使用來保留這些混" -"合類型的 :class:`str() `。" +"合型別的 :class:`str() `。" #: ../../library/enum.rst:101 msgid ":class:`EnumCheck`" @@ -331,20 +341,19 @@ msgid "" "to subclass *EnumType* -- see :ref:`Subclassing EnumType ` for details." msgstr "" -"*EnumType* 是\\ *列舉*\\ 的 :term:`metaclass`。*EnumType* 可以有子類別 -- 細" +"*EnumType* 是 *enum* 列舉的 :term:`metaclass`。*EnumType* 可以有子類別 -- 細" "節請參考 :ref:`建立 EnumType 的子類別 `。" #: ../../library/enum.rst:168 -#, fuzzy msgid "" "``EnumType`` is responsible for setting the correct :meth:`!__repr__`, :meth:" "`!__str__`, :meth:`!__format__`, and :meth:`!__reduce__` methods on the " "final *enum*, as well as creating the enum members, properly handling " "duplicates, providing iteration over the enum class, etc." msgstr "" -"*EnumType* 負責在最後的\\ *列舉*\\ 上面設定正確的 :meth:`!__repr__`、:meth:`!" -"__str__`、:meth:`!__format__` 及 :meth:`!__reduce__` 方法,以及建立列舉成員," -"並正確處理重複,提供列舉類別的疊代等等。" +"``EnumType`` 負責在最後的\\ *列舉*\\ 上面設定正確的 :meth:`!__repr__`、:meth:" +"`!__str__`、:meth:`!__format__` 及 :meth:`!__reduce__` 方法,以及建立列舉成" +"員、正確處理重複、提供列舉類別的疊代等等。" #: ../../library/enum.rst:175 msgid "This method is called in two different ways:" @@ -410,7 +419,7 @@ msgstr "type" #: ../../library/enum.rst:190 msgid "A mix-in type for the new Enum." -msgstr "新列舉的混合類型。" +msgstr "新列舉的混合型別。" #: ../../library/enum.rst:0 msgid "start" @@ -534,20 +543,22 @@ msgid "" "Adds a new name as an alias to an existing member. Raises a :exc:" "`NameError` if the name is already assigned to a different member." msgstr "" +"新增一個名稱作為現有成員的別名。如果該名稱已被指派給不同的成員,則會引發 :" +"exc:`NameError`。" #: ../../library/enum.rst:256 msgid "" "Adds a new value as an alias to an existing member. Raises a :exc:" "`ValueError` if the value is already linked with a different member." msgstr "" +"新增一個值作為現有成員的別名。如果該值已與不同成員連結,則會引發 :exc:" +"`ValueError`。" #: ../../library/enum.rst:261 -#, fuzzy msgid "" "Before 3.11 ``EnumType`` was called ``EnumMeta``, which is still available " "as an alias." -msgstr "" -"在 3.11 之前,``enum`` 使用 ``EnumMeta`` 類型,目前保留此類型當作別名。" +msgstr "在 3.11 之前,``EnumType`` 稱作 ``EnumMeta``,其目前仍可作為別名使用。" #: ../../library/enum.rst:266 msgid "*Enum* is the base class for all *enum* enumerations." @@ -602,6 +613,9 @@ msgid "" "quadratic performance impact during creation relative to the total number of " "mutable/unhashable values in the enum." msgstr "" +"雖然可以使用可變的 (mutable) / 不可雜湊的 (unhashable) 值,例如 :class:" +"`dict`、:class:`list` 或可變的 :class:`~dataclasses.dataclass`,它們在建立期" +"間會對效能產生相對於列舉中可變的 / 不可雜湊的值總數量的二次方影響。" #: ../../library/enum.rst:298 msgid "Name of the member." @@ -806,7 +820,7 @@ msgstr "" #: ../../library/enum.rst:408 msgid "" "results in the call ``int('1a', 16)`` and a value of ``26`` for the member." -msgstr "" +msgstr "會產生呼叫 ``int('1a', 16)`` 而該成員的值為 ``26``。" #: ../../library/enum.rst:412 msgid "" @@ -925,15 +939,14 @@ msgid "Added :ref:`enum-dataclass-support`" msgstr "新增 :ref:`enum-dataclass-support`" #: ../../library/enum.rst:471 -#, fuzzy msgid "" "*IntEnum* is the same as :class:`Enum`, but its members are also integers " "and can be used anywhere that an integer can be used. If any integer " "operation is performed with an *IntEnum* member, the resulting value loses " "its enumeration status." msgstr "" -"*IntEnum* 和 *Enum* 一樣,但其成員同時也是整數而可以被用在任何使用整數的地" -"方。如果 *IntEnum* 成員經過任何整數運算,其結果會失去列舉狀態。" +"*IntEnum* 和 :class:`Enum` 一樣,但其成員同時也是整數而可以被用在任何使用整數" +"的地方。如果 *IntEnum* 成員經過任何整數運算,結果值會失去其列舉狀態。" #: ../../library/enum.rst:492 msgid "" @@ -952,15 +965,14 @@ msgstr "" "meth:`~object.__format__` 已經是 :meth:`!int.__format__`。" #: ../../library/enum.rst:502 -#, fuzzy msgid "" "``StrEnum`` is the same as :class:`Enum`, but its members are also strings " "and can be used in most of the same places that a string can be used. The " "result of any string operation performed on or with a *StrEnum* member is " "not part of the enumeration." msgstr "" -"*StrEnum* 和 *Enum* 一樣,但其成員同時也是字串而可以被用在幾乎所有使用字串的" -"地方。*StrEnum* 成員經過任何字串操作的結果會不再是列舉的一部份。" +"``StrEnum`` 和 :class:`Enum` 一樣,但其成員同時也是字串而可以被用在幾乎所有使" +"用字串的地方。*StrEnum* 成員經過任何字串操作的結果會不再是列舉的一部份。" #: ../../library/enum.rst:508 msgid "" @@ -1138,9 +1150,8 @@ msgstr "" "" #: ../../library/enum.rst:614 -#, fuzzy msgid "Returns all the flags in *type(self)* that are not in *self*::" -msgstr "回傳所有在 *type(self)* 但不在 self 裡的旗標: ::" +msgstr "回傳所有在 *type(self)* 但不在 *self* 裡的旗標: ::" #: ../../library/enum.rst:616 msgid "" @@ -1177,13 +1188,12 @@ msgid "The *repr()* of zero-valued flags has changed. It is now::" msgstr "值為 0 的旗標的 *repr()* 已改變。現在是: ::" #: ../../library/enum.rst:641 -#, fuzzy msgid "" "``IntFlag`` is the same as :class:`Flag`, but its members are also integers " "and can be used anywhere that an integer can be used." msgstr "" -"*IntFlag* 和 *Flag* 一樣,但其成員同時也是整數而可以被用在任何使用整數的地" -"方。" +"``IntFlag`` 和 :class:`Flag` 一樣,但其成員同時也是整數而可以被用在任何使用整" +"數的地方。" #: ../../library/enum.rst:655 msgid "" @@ -1200,25 +1210,22 @@ msgstr "" "3" #: ../../library/enum.rst:661 -#, fuzzy msgid "If a :class:`Flag` operation is performed with an *IntFlag* member and:" -msgstr "如果 *IntFlag* 成員經過 *Flag* 操作且:" +msgstr "如果 *IntFlag* 成員經過 :class:`Flag` 操作且:" #: ../../library/enum.rst:663 msgid "the result is a valid *IntFlag*: an *IntFlag* is returned" msgstr "結果是合法的 *IntFlag*:回傳 *IntFlag*" #: ../../library/enum.rst:664 -#, fuzzy msgid "" "the result is not a valid *IntFlag*: the result depends on the :class:" "`FlagBoundary` setting" -msgstr "結果不是合法的 *IntFlag*:結果會根據 *FlagBoundary* 的設定" +msgstr "結果不是合法的 *IntFlag*:結果會根據 :class:`FlagBoundary` 的設定" #: ../../library/enum.rst:666 -#, fuzzy msgid "The :func:`repr` of unnamed zero-valued flags has changed. It is now:" -msgstr "未命名且值為 0 的旗標的 *repr()* 已改變。現在是: ::" +msgstr "未命名且值為 0 的旗標的 :func:`repr` 已改變。現在是:" #: ../../library/enum.rst:673 msgid "" @@ -1252,7 +1259,7 @@ msgid "" "but the :class:`str() ` of the mixed-in data type:" msgstr "" ":class:`!ReprEnum` 使用 :class:`Enum` 的 :meth:`repr() `,但使" -"用混合資料類型的 :class:`str() `:" +"用混合資料型別的 :class:`str() `:" #: ../../library/enum.rst:691 msgid ":meth:`!int.__str__` for :class:`IntEnum` and :class:`IntFlag`" @@ -1268,7 +1275,7 @@ msgid "" "`format` of the mixed-in data type instead of using the :class:`Enum`-" "default :meth:`str() `." msgstr "" -"繼承 :class:`!ReprEnum` 來保留混合資料類型的 :class:`str() ` / :func:" +"繼承 :class:`!ReprEnum` 來保留混合資料型別的 :class:`str() ` / :func:" "`format`,而不是使用 :class:`Enum` 預設的 :meth:`str() `。" #: ../../library/enum.rst:703 @@ -1377,11 +1384,10 @@ msgid "" msgstr "CONTINUOUS 和 NAMED_FLAGS 是設計用來運作在整數值的成員上。" #: ../../library/enum.rst:762 -#, fuzzy msgid "" "``FlagBoundary`` controls how out-of-range values are handled in :class:" "`Flag` and its subclasses." -msgstr "*FlagBoundary* 控制在 *Flag* 及其子類別中如何處理範圍外的值。" +msgstr "``FlagBoundary`` 控制在 :class:`Flag` 及其子類別中如何處理範圍外的值。" #: ../../library/enum.rst:767 msgid "" @@ -1418,11 +1424,10 @@ msgstr "" " allowed 0b0 00111" #: ../../library/enum.rst:785 -#, fuzzy msgid "" "Out-of-range values have invalid values removed, leaving a valid :class:" "`Flag` value::" -msgstr "範圍外的值會移除非法值,留下合法的 *Flag* 值: ::" +msgstr "會移除範圍外的值中的非法值,留下合法的 :class:`Flag` 值: ::" #: ../../library/enum.rst:788 msgid "" @@ -1445,20 +1450,18 @@ msgstr "" "" #: ../../library/enum.rst:799 -#, fuzzy msgid "" "Out-of-range values lose their :class:`Flag` membership and revert to :class:" "`int`." -msgstr "範圍外的值會失去它們的 *Flag* 成員資格且恢復成 :class:`int`。" +msgstr "範圍外的值會失去它們的 :class:`Flag` 成員資格且恢復成 :class:`int`。" #: ../../library/enum.rst:812 -#, fuzzy msgid "" "Out-of-range values are kept, and the :class:`Flag` membership is kept. This " "is the default for :class:`IntFlag`::" msgstr "" -"範圍外的值會被保留,*Flag* 成員資格也會被保留。這是 :class:`IntFlag` 的預設行" -"為: ::" +"範圍外的值會被保留,:class:`Flag` 成員資格也會被保留。這是 :class:`IntFlag` " +"的預設行為: ::" #: ../../library/enum.rst:815 msgid "" @@ -1482,7 +1485,7 @@ msgstr "" #: ../../library/enum.rst:829 msgid "Supported ``__dunder__`` names" -msgstr "支援 ``__dunder__`` 名稱" +msgstr "支援的 ``__dunder__`` 名稱" #: ../../library/enum.rst:831 msgid "" @@ -1493,31 +1496,30 @@ msgstr "" "目的對映。只有在類別上可用。" #: ../../library/enum.rst:834 -#, fuzzy msgid "" ":meth:`~Enum.__new__`, if specified, must create and return the enum " "members; it is also a very good idea to set the member's :attr:`!_value_` " "appropriately. Once all the members are created it is no longer used." msgstr "" -"如果指定了 :meth:`~Enum.__new__`,它必須建立並回傳列舉成員;適當地設定成員" +":meth:`~Enum.__new__`,如果有指定,它必須建立並回傳列舉成員;適當地設定成員" "的 :attr:`!_value_` 也是一個很好的主意。一旦所有成員都建立之後就不會再被用" "到。" #: ../../library/enum.rst:840 msgid "Supported ``_sunder_`` names" -msgstr "支援 ``_sunder_`` 名稱" +msgstr "支援的 ``_sunder_`` 名稱" #: ../../library/enum.rst:842 msgid "" ":meth:`~EnumType._add_alias_` -- adds a new name as an alias to an existing " "member." -msgstr "" +msgstr ":meth:`~EnumType._add_alias_` -- 新增一個名稱作為現有成員的別名。" #: ../../library/enum.rst:844 msgid "" ":meth:`~EnumType._add_value_alias_` -- adds a new value as an alias to an " "existing member." -msgstr "" +msgstr ":meth:`~EnumType._add_value_alias_` -- 新增一個值作為現有成員的別名。" #: ../../library/enum.rst:846 msgid ":attr:`~Enum._name_` -- name of the member" @@ -1559,32 +1561,33 @@ msgstr "" ":meth:`~Enum._generate_next_value_` -- 用來為列舉成員取得合適的值;可以被覆寫" #: ../../library/enum.rst:860 -#, fuzzy msgid "" "For standard :class:`Enum` classes the next value chosen is the highest " "value seen incremented by one." msgstr "" -"對標準的 :class:`Enum` 類別來說,下一個被選擇的值是最後一個看見的值加一。" +"對標準的 :class:`Enum` 類別來說,下一個被選擇的值是所看過的最大值加一。" #: ../../library/enum.rst:863 -#, fuzzy msgid "" "For :class:`Flag` classes the next value chosen will be the next highest " "power-of-two." msgstr "" -"對 :class:`Flag` 類別來說,下一個被選擇的值是下一個最大的 2 的次方,不管最後" -"一個看見的值是什麼。" +"對 :class:`Flag` 類別來說,下一個被選擇的值是下一個最大的 2 的次方的數字。" #: ../../library/enum.rst:866 msgid "" "While ``_sunder_`` names are generally reserved for the further development " "of the :class:`Enum` class and can not be used, some are explicitly allowed:" msgstr "" +"雖然 ``_sunder_`` 名稱通常保留用於 :class:`Enum` 類別的進一步開發而不能被使" +"用,但有些是明確允許的:" #: ../../library/enum.rst:869 msgid "" "``_repr_*`` (e.g. ``_repr_html_``), as used in `IPython's rich display`_" msgstr "" +"``_repr_*``(例如 ``_repr_html_``),例如用於 `IPython 的豐富顯示 `_" #: ../../library/enum.rst:871 msgid "``_missing_``, ``_order_``, ``_generate_next_value_``" @@ -1596,14 +1599,13 @@ msgstr "``_ignore_``" #: ../../library/enum.rst:873 msgid "``_add_alias_``, ``_add_value_alias_``, ``_repr_*``" -msgstr "" +msgstr "``_add_alias_``、``_add_value_alias_``、``_repr_*``" #: ../../library/enum.rst:879 msgid "Utilities and Decorators" msgstr "通用項目與裝飾器" #: ../../library/enum.rst:883 -#, fuzzy msgid "" "*auto* can be used in place of a value. If used, the *Enum* machinery will " "call an :class:`Enum`'s :meth:`~Enum._generate_next_value_` to get an " @@ -1613,11 +1615,11 @@ msgid "" "for :class:`StrEnum` it will be the lower-cased version of the member's " "name. Care must be taken if mixing *auto()* with manually specified values." msgstr "" -"*auto* 可以用來取代給值。如果使用的話,*Enum* 系統會呼叫 *Enum* 的 :meth:" -"`~Enum._generate_next_value_` 來取得合適的值。對 *Enum* 和 *IntEnum* 來說,合" -"適的值是最後一個值加一;對 *Flag* 和 *IntFlag* 來說,是第一個比最大值還大的 " -"2 的次方的數字;對 *StrEnum* 來說,是成員名稱的小寫版本。如果混用 *auto()* 和" -"手動指定值的話要特別注意。" +"*auto* 可以用來取代給值。如果使用的話,*Enum* 系統會呼叫 :class:`Enum` 的 :" +"meth:`~Enum._generate_next_value_` 來取得合適的值。對 :class:`Enum` 和 :" +"class:`IntEnum` 來說,合適的值是最後一個值加一;對 :class:`Flag` 和 :class:" +"`IntFlag` 來說,是第一個比最大值還大的 2 的次方的數字;對 :class:`StrEnum` 來" +"說,是成員名稱的小寫版本。如果混用 *auto()* 和手動指定值的話要特別注意。" #: ../../library/enum.rst:891 msgid "" @@ -1663,7 +1665,7 @@ msgid "" "incompatible type." msgstr "" "在 3.13 預設 ``_generate_next_value_`` 總是回傳最大的成員值加一,如果任何成員" -"是不相容的類型就會失敗。" +"是不相容的型別就會失敗。" #: ../../library/enum.rst:913 msgid "" @@ -1765,7 +1767,7 @@ msgid "" "These three enum types are designed to be drop-in replacements for existing " "integer- and string-based values; as such, they have extra limitations:" msgstr "" -"這三種列舉類型是設計來直接取代現有以整數及字串為基底的值;因此它們有額外的限" +"這三種列舉型別是設計來直接取代現有以整數及字串為基底的值;因此它們有額外的限" "制:" #: ../../library/enum.rst:988 @@ -1783,7 +1785,7 @@ msgid "" "If you do not need/want those limitations, you can either create your own " "base class by mixing in the ``int`` or ``str`` type yourself::" msgstr "" -"如果你不需要或不想要這些限制,你可以透過混合 ``int`` 或 ``str`` 類型來建立自" +"如果你不需要或不想要這些限制,你可以透過混合 ``int`` 或 ``str`` 型別來建立自" "己的基礎類別: ::" #: ../../library/enum.rst:996 diff --git a/library/exceptions.po b/library/exceptions.po index eb2e321fa6..b413eabffe 100644 --- a/library/exceptions.po +++ b/library/exceptions.po @@ -9,7 +9,7 @@ msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-23 07:52+0800\n" -"PO-Revision-Date: 2024-09-17 09:18+0800\n" +"PO-Revision-Date: 2024-12-20 16:57+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -18,7 +18,6 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.4.2\n" #: ../../library/exceptions.rst:4 msgid "Built-in Exceptions" @@ -163,7 +162,7 @@ msgid "" "possible conflicts between how the bases handle the ``args`` attribute, as " "well as due to possible memory layout incompatibilities." msgstr "" -"使用者的程式碼可以建立繼承自例外類型的子類別。建議一次只繼承一種例外類型以避" +"使用者的程式碼可以建立繼承自例外型別的子類別。建議一次只繼承一種例外型別以避" "免在基底類別之間如何處理 ``args`` 屬性的任何可能衝突,以及可能的記憶體佈局 " "(memory layout) 不相容。" @@ -177,9 +176,9 @@ msgid "" "it's recommended to avoid subclassing multiple exception types altogether." msgstr "" "為了效率,大部分的內建例外使用 C 來實作,參考 :source:`Objects/exceptions." -"c`。一些例外有客製化的記憶體佈局,使其不可能建立一個繼承多種例外類型的子類" -"別。類型的記憶體佈局是實作細節且可能會在不同 Python 版本間改變,造成未來新的" -"衝突。因此,總之建議避免繼承多種例外類型。" +"c`。一些例外有客製化的記憶體佈局,使其不可能建立一個繼承多種例外型別的子類" +"別。型別的記憶體佈局是實作細節且可能會在不同 Python 版本間改變,造成未來新的" +"衝突。因此,總之建議避免繼承多種例外型別。" #: ../../library/exceptions.rst:105 msgid "Base classes" @@ -624,24 +623,26 @@ msgstr "" "化,大部分的浮點數運算都沒有被檢查。" #: ../../library/exceptions.rst:421 -#, fuzzy msgid "" "This exception is derived from :exc:`RuntimeError`. It is raised when an " "operation is blocked during interpreter shutdown also known as :term:`Python " "finalization `." msgstr "" -"此例外衍生自 :exc:`RuntimeError`。當直譯器偵測到超過最大的遞迴深度(參考 :" -"func:`sys.getrecursionlimit`)時會引發此例外。" +"此例外衍生自 :exc:`RuntimeError`。當一個操作在直譯器關閉(也稱作 :term:" +"`Python 最終化 (Python finalization) `)期間被阻塞會引" +"發此例外。" #: ../../library/exceptions.rst:425 msgid "" "Examples of operations which can be blocked with a :exc:" "`PythonFinalizationError` during the Python finalization:" msgstr "" +"在 Python 最終化期間,能夠以 :exc:`PythonFinalizationError` 被阻塞的操作範" +"例:" #: ../../library/exceptions.rst:428 msgid "Creating a new Python thread." -msgstr "" +msgstr "建立新的 Python 執行緒。" #: ../../library/exceptions.rst:429 msgid ":func:`os.fork`." @@ -649,7 +650,7 @@ msgstr ":func:`os.fork`。" #: ../../library/exceptions.rst:431 msgid "See also the :func:`sys.is_finalizing` function." -msgstr "" +msgstr "也可以參閱 :func:`sys.is_finalizing` 函式。" #: ../../library/exceptions.rst:433 ../../library/exceptions.rst:443 msgid "Previously, a plain :exc:`RuntimeError` was raised." @@ -878,7 +879,7 @@ msgstr "" "可以正確地向上傳遞並導致直譯器結束。當它未被處理時,Python 直譯器會結束;不會" "印出堆疊回溯。建構函式接受跟傳入 :func:`sys.exit` 一樣的可選引數。如果該值是" "整數,它會指定系統的結束狀態(傳入 C 的 :c:func:`exit` 函式 );如果它是 " -"``None``,結束狀態會是 0;如果它是其他類型(例如字串),則物件的值會被印出而" +"``None``,結束狀態會是 0;如果它是其他型別(例如字串),則物件的值會被印出而" "結束狀態是 1。" #: ../../library/exceptions.rst:587 @@ -907,8 +908,8 @@ msgid "" "inappropriate type. The associated value is a string giving details about " "the type mismatch." msgstr "" -"當一個操作或函式被用在不適合的類型的物件時會引發此例外。關聯值是一個字串,提" -"供關於不相符類型的細節。" +"當一個操作或函式被用在不適合的型別的物件時會引發此例外。關聯值是一個字串,提" +"供關於不相符型別的細節。" #: ../../library/exceptions.rst:605 msgid "" @@ -928,7 +929,7 @@ msgid "" "arguments with the wrong value (e.g. a number outside expected boundaries) " "should result in a :exc:`ValueError`." msgstr "" -"傳入錯誤類型的引數(例如當預期傳入 :class:`int` 卻傳入 :class:`list`)應該要" +"傳入錯誤型別的引數(例如當預期傳入 :class:`int` 卻傳入 :class:`list`)應該要" "導致 :exc:`TypeError`,但傳入帶有錯誤值的引數(例如超出預期範圍的數值)應該要" "導致 :exc:`ValueError`。" @@ -1008,7 +1009,7 @@ msgid "" "type but an inappropriate value, and the situation is not described by a " "more precise exception such as :exc:`IndexError`." msgstr "" -"當一個操作或函式收到引數是正確類型但是不適合的值,且該情況無法被更精確的例外" +"當一個操作或函式收到引數是正確型別但是不適合的值,且該情況無法被更精確的例外" "例如 :exc:`IndexError` 所描述時會引發此例外。" #: ../../library/exceptions.rst:679 @@ -1337,7 +1338,7 @@ msgid "" "based on the types of the contained exceptions." msgstr "" "當需要引發多個不相關例外時會使用下列的類別。它們是例外階層的一部分所以可以像" -"所有其他例外一樣使用 :keyword:`except` 來處理。此外,它們會以包含的例外類型為" +"所有其他例外一樣使用 :keyword:`except` 來處理。此外,它們會以包含的例外型別為" "基礎來比對其子群組而被 :keyword:`except*` 辨認出來。" #: ../../library/exceptions.rst:932 @@ -1350,7 +1351,7 @@ msgid "" "is so that ``except Exception`` catches an :exc:`ExceptionGroup` but not :" "exc:`BaseExceptionGroup`." msgstr "" -"這兩個例外類型都將例外包裝在序列 ``excs`` 中。``msg`` 參數必須是字串。這兩個" +"這兩個例外型別都將例外包裝在序列 ``excs`` 中。``msg`` 參數必須是字串。這兩個" "類別的差異是 :exc:`BaseExceptionGroup` 擴充了 :exc:`BaseException` 且可以包裝" "任何例外,而 :exc:`ExceptionGroup` 擴充了 :exc:`Exception` 且只能包裝 :exc:" "`Exception` 的子類別。這個設計使得 ``except Exception`` 可以捕捉 :exc:" @@ -1395,6 +1396,10 @@ msgid "" "type object) that accepts an exception as its single argument and returns " "true for the exceptions that should be in the subgroup." msgstr "" +"條件式可以是一個例外型別或是例外型別的元組,在此情況下,每個例外都會使用與 " +"``except`` 子句中使用的相同檢查方法來檢查是否有匹配。條件式也可以是一個可呼叫" +"物件(除了型別物件之外),其接受一個例外作為單一引數,而如果該例外應該在子群" +"組中就回傳 true。" #: ../../library/exceptions.rst:967 msgid "" @@ -1420,7 +1425,7 @@ msgstr "" #: ../../library/exceptions.rst:978 msgid "``condition`` can be any callable which is not a type object." -msgstr "" +msgstr "``condition`` 可以是任何不是型別物件的可呼叫物件。" #: ../../library/exceptions.rst:983 msgid "" @@ -1565,7 +1570,6 @@ msgid "The class hierarchy for built-in exceptions is:" msgstr "內建例外的類別階層如下:" #: ../../library/exceptions.rst:1058 -#, fuzzy msgid "" "BaseException\n" " ├── BaseExceptionGroup\n" @@ -1678,6 +1682,7 @@ msgstr "" " ├── ReferenceError\n" " ├── RuntimeError\n" " │ ├── NotImplementedError\n" +" │ ├── PythonFinalizationError\n" " │ └── RecursionError\n" " ├── StopAsyncIteration\n" " ├── StopIteration\n" @@ -1752,13 +1757,3 @@ msgstr "module(模組)" #: ../../library/exceptions.rst:345 msgid "errno" msgstr "errno" - -#~ msgid "" -#~ "The condition can be either a function that accepts an exception and " -#~ "returns true for those that should be in the subgroup, or it can be an " -#~ "exception type or a tuple of exception types, which is used to check for " -#~ "a match using the same check that is used in an ``except`` clause." -#~ msgstr "" -#~ "條件可以是一個函式,接受一個例外並對那些應該要在子群組裡的例外回傳 true," -#~ "或者可以是一個例外類型或例外類型的元組,並使用與 ``except`` 子句所使用的相" -#~ "同檢查來檢查是否有比對到。"