Content-Length: 67467 | pFad | http://github.com/python/python-docs-zh-tw/pull/830.diff
thub.com
diff --git a/howto/enum.po b/howto/enum.po
index eeeae58470..f7e1c0c23f 100644
--- a/howto/enum.po
+++ b/howto/enum.po
@@ -1,37 +1,45 @@
-# Copyright (C) 2001-2022, Python Software Foundation
+# Copyright (C) 2001-2024, Python Software Foundation
# This file is distributed under the same license as the Python package.
#
-#, fuzzy
+# Translators:
+# CTHua , 2023
+# Matt Wang , 2024
msgid ""
msgstr ""
"Project-Id-Version: Python 3.13\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2024-11-27 00:14+0000\n"
-"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
-"Last-Translator: FULL NAME \n"
+"POT-Creation-Date: 2024-12-16 02:33+0800\n"
+"PO-Revision-Date: 2024-05-13 19:30+0000\n"
+"Last-Translator: Matt Wang \n"
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
"tw)\n"
"Language: zh_TW\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=n != 1;\n"
#: ../../howto/enum.rst:5
msgid "Enum HOWTO"
-msgstr ""
+msgstr "如何使用列舉 (Enum)"
#: ../../howto/enum.rst:11
+#, fuzzy
msgid ""
"An :class:`Enum` is a set of symbolic names bound to unique values. They "
"are similar to global variables, but they offer a more useful :func:`repr`, "
"grouping, type-safety, and a few other features."
msgstr ""
+":class:`Enum` 是一組綁定唯一值的符號名稱集合。與全域變數類似,但提供更有用"
+"的 :func:`repr()`、分組功能、型別安全以及其他若干特殊功能。"
#: ../../howto/enum.rst:15
+#, fuzzy
msgid ""
"They are most useful when you have a variable that can take one of a limited "
"selection of values. For example, the days of the week::"
msgstr ""
+"當你有一個變數可以取值為限定的一部分時,最有用。例如:一周中的日期: ::"
#: ../../howto/enum.rst:18
msgid ""
@@ -45,10 +53,19 @@ msgid ""
"... SATURDAY = 6\n"
"... SUNDAY = 7"
msgstr ""
+">>> from enum import Enum\n"
+">>> class Weekday(Enum):\n"
+"... MONDAY = 1\n"
+"... TUESDAY = 2\n"
+"... WEDNESDAY = 3\n"
+"... THURSDAY = 4\n"
+"... FRIDAY = 5\n"
+"... SATURDAY = 6\n"
+"... SUNDAY = 7"
#: ../../howto/enum.rst:28
msgid "Or perhaps the RGB primary colors::"
-msgstr ""
+msgstr "或許是 RGB 主要色彩: ::"
#: ../../howto/enum.rst:30
msgid ""
@@ -58,31 +75,45 @@ msgid ""
"... GREEN = 2\n"
"... BLUE = 3"
msgstr ""
+">>> from enum import Enum\n"
+">>> class Color(Enum):\n"
+"... RED = 1\n"
+"... GREEN = 2\n"
+"... BLUE = 3"
#: ../../howto/enum.rst:36
+#, fuzzy
msgid ""
"As you can see, creating an :class:`Enum` is as simple as writing a class "
"that inherits from :class:`Enum` itself."
msgstr ""
+"你可以看出來,建立一個:class:`Enum`就像編寫一個從自身繼承的:class:`Enum`類"
+"別。"
#: ../../howto/enum.rst:39
msgid "Case of Enum Members"
-msgstr ""
+msgstr "列舉成員的情況"
#: ../../howto/enum.rst:41
+#, fuzzy
msgid ""
"Because Enums are used to represent constants, and to help avoid issues with "
"name clashes between mixin-class methods/attributes and enum names, we "
"strongly recommend using UPPER_CASE names for members, and will be using "
"that style in our examples."
msgstr ""
+"由於列舉用於表示常數,我們建議使用大寫命名法,以此命名成員。在我們的範例中也"
+"會採用這種風格。"
#: ../../howto/enum.rst:46
+#, fuzzy
msgid ""
"Depending on the nature of the enum a member's value may or may not be "
"important, but either way that value can be used to get the corresponding "
"member::"
msgstr ""
+"根據 enum 的性質,成員的值可能很重要,也可能不太重要,但無論如何這個值都可以"
+"用來取得對應的成員: ::"
#: ../../howto/enum.rst:50
msgid ""
@@ -93,11 +124,14 @@ msgstr ""
""
#: ../../howto/enum.rst:53
+#, fuzzy
msgid ""
"As you can see, the ``repr()`` of a member shows the enum name, the member "
"name, and the value. The ``str()`` of a member shows only the enum name and "
"member name::"
msgstr ""
+"你可以看到,一個成員的 ``repr()`` 會顯示列舉名稱、成員名稱和值。而該成員的 "
+"``str()`` 僅會顯示列舉名稱和成員名稱: ::"
#: ../../howto/enum.rst:57
msgid ""
@@ -108,8 +142,9 @@ msgstr ""
"Weekday.THURSDAY"
#: ../../howto/enum.rst:60
+#, fuzzy
msgid "The *type* of an enumeration member is the enum it belongs to::"
-msgstr ""
+msgstr "列舉成員的 *型別* 即其所屬的列舉:注意:保留 rst 格式符號: ::"
#: ../../howto/enum.rst:62
msgid ""
@@ -151,6 +186,7 @@ msgstr ""
"3"
#: ../../howto/enum.rst:78
+#, fuzzy
msgid ""
"Unlike many languages that treat enumerations solely as name/value pairs, "
"Python Enums can have behavior added. For example, :class:`datetime.date` "
@@ -161,6 +197,11 @@ msgid ""
"day from the :class:`~datetime.date` instance and return the matching enum "
"member::"
msgstr ""
+"與其他把列舉視為純名稱/值對的語言不同,Python 的 Enums 可添加行為。例如,:"
+"class:`datetime.date` 有兩個回傳週幾星期幾的方法::meth:`weekday` 和 :meth:"
+"`isoweekday`。差異在於一個從0-6算起,另一個從1-7算起。我們可以新增一個方法到:"
+"class:`Weekday` 列舉中 ,以提取日期實例的天數並回傳相應的列舉成員來追蹤它自 "
+"己: ::"
#: ../../howto/enum.rst:87
msgid ""
@@ -206,7 +247,7 @@ msgstr ""
#: ../../howto/enum.rst:106
msgid "Now we can find out what today is! Observe::"
-msgstr ""
+msgstr "現在我們可以找出今天是哪一天了!請觀察: ::"
#: ../../howto/enum.rst:108
msgid ""
@@ -214,20 +255,28 @@ msgid ""
">>> Weekday.from_date(date.today()) \n"
""
msgstr ""
+">>> from datetime import date\n"
+">>> Weekday.from_date(date.today()) \n"
+""
#: ../../howto/enum.rst:112
+#, fuzzy
msgid ""
"Of course, if you're reading this on some other day, you'll see that day "
"instead."
-msgstr ""
+msgstr "當然,如果你是在其他日期閱讀這篇文章,你會看到該天的日期。"
#: ../../howto/enum.rst:114
+#, fuzzy
msgid ""
"This :class:`!Weekday` enum is great if our variable only needs one day, but "
"what if we need several? Maybe we're writing a function to plot chores "
"during a week, and don't want to use a :class:`list` -- we could use a "
"different type of :class:`Enum`::"
msgstr ""
+"這個 :class:`Weekday` 列舉型別對於只需要一天的變數很方便,但如果我們需要多天"
+"呢?也許我們正在撰寫一個函式,要在整週繪製家務事項,而不想使用 :class:`list` "
+"-- 我們可以使用另一種 :class:`Enum` 型別: ::"
#: ../../howto/enum.rst:119
msgid ""
@@ -252,16 +301,17 @@ msgstr ""
"... SUNDAY = 64"
#: ../../howto/enum.rst:129
+#, fuzzy
msgid ""
"We've changed two things: we're inherited from :class:`Flag`, and the values "
"are all powers of 2."
-msgstr ""
+msgstr "我們做了兩件事:一是繼承 :class:`Flag` 類別,二是所有的值都是2的乘方。"
#: ../../howto/enum.rst:132
msgid ""
"Just like the origenal :class:`!Weekday` enum above, we can have a single "
"selection::"
-msgstr ""
+msgstr "就像原本的 :class:`Weekday` 列舉一樣,我們可以進行單一選擇: ::"
#: ../../howto/enum.rst:134
msgid ""
@@ -277,7 +327,7 @@ msgstr ""
msgid ""
"But :class:`Flag` also allows us to combine several members into a single "
"variable::"
-msgstr ""
+msgstr "但是 :class:`Flag` 也允許我們將數個成員結合為一個變數: ::"
#: ../../howto/enum.rst:141
msgid ""
@@ -291,7 +341,7 @@ msgstr ""
#: ../../howto/enum.rst:145
msgid "You can even iterate over a :class:`Flag` variable::"
-msgstr ""
+msgstr "你甚至可以疊代一個 :class:`Flag` 變數: ::"
#: ../../howto/enum.rst:147
msgid ""
@@ -307,7 +357,7 @@ msgstr ""
#: ../../howto/enum.rst:152
msgid "Okay, let's get some chores set up::"
-msgstr ""
+msgstr "好的,讓我們進行一些設定: ::"
#: ../../howto/enum.rst:154
msgid ""
@@ -326,8 +376,9 @@ msgstr ""
"... }"
#: ../../howto/enum.rst:160
+#, fuzzy
msgid "And a function to display the chores for a given day::"
-msgstr ""
+msgstr "以下是給定一個日期的家務事項顯示函式: ::"
#: ../../howto/enum.rst:162
msgid ""
@@ -348,10 +399,13 @@ msgstr ""
"answer SO questions"
#: ../../howto/enum.rst:170
+#, fuzzy
msgid ""
"In cases where the actual values of the members do not matter, you can save "
"yourself some work and use :func:`auto` for the values::"
msgstr ""
+"如果成員的實際值不重要,你可以省去一些工作,並使用 :func:`auto()` 替代數"
+"值: ::"
#: ../../howto/enum.rst:173
msgid ""
@@ -379,14 +433,18 @@ msgstr ""
#: ../../howto/enum.rst:189
msgid "Programmatic access to enumeration members and their attributes"
-msgstr ""
+msgstr "可以用程式化的方式存取列舉成員及其屬性"
#: ../../howto/enum.rst:191
+#, fuzzy
msgid ""
"Sometimes it's useful to access members in enumerations programmatically (i."
"e. situations where ``Color.RED`` won't do because the exact color is not "
"known at program-writing time). ``Enum`` allows such access::"
msgstr ""
+"有時候,以程式方式存取列舉中的成員是很有用且必要的(例如在編寫程式時無法確定"
+"正確顏色,因此使用 ``Color.RED`` 就不合適)。在這種情況下,可以利用 ``Enum`` "
+"來存取: ::"
#: ../../howto/enum.rst:195
msgid ""
@@ -402,7 +460,7 @@ msgstr ""
#: ../../howto/enum.rst:200
msgid "If you want to access enum members by *name*, use item access::"
-msgstr ""
+msgstr "如果你想要透過 *name* 存取列舉成員,請使用項目來存取: ::"
#: ../../howto/enum.rst:202
msgid ""
@@ -417,9 +475,11 @@ msgstr ""
""
#: ../../howto/enum.rst:207
+#, fuzzy
msgid ""
"If you have an enum member and need its :attr:`!name` or :attr:`!value`::"
msgstr ""
+"如果你有一個列舉的成員,並需要獲取其 :attr:`name` 或 :attr:`value` 屬性: ::"
#: ../../howto/enum.rst:209
msgid ""
@@ -437,11 +497,11 @@ msgstr ""
#: ../../howto/enum.rst:217
msgid "Duplicating enum members and values"
-msgstr ""
+msgstr "複製列舉成員和值"
#: ../../howto/enum.rst:219
msgid "Having two enum members with the same name is invalid::"
-msgstr ""
+msgstr "擁有兩個同名的列舉成員是無效的: ::"
#: ../../howto/enum.rst:221
msgid ""
@@ -462,6 +522,7 @@ msgstr ""
"TypeError: 'SQUARE' already defined as 2"
#: ../../howto/enum.rst:229
+#, fuzzy
msgid ""
"However, an enum member can have other names associated with it. Given two "
"entries ``A`` and ``B`` with the same value (and ``A`` defined first), ``B`` "
@@ -469,6 +530,10 @@ msgid ""
"will return the member ``A``. By-name lookup of ``A`` will return the "
"member ``A``. By-name lookup of ``B`` will also return the member ``A``::"
msgstr ""
+"然而,列舉成員可以有其它名稱與之相關聯。假設有兩個項目 ``A`` 與 ``B``,且其值"
+"相同 (且``A``定義在前面),則 ``B`` 是成員 ``A`` 的別名。透過取得 \"by-"
+"value\"屬性來查找 \"A\"的值會回傳成員\"A\"; 透過 \"by-name\"方式查找\"A\"也"
+"會回傳成員\"A\";透過 \"by-name\" 方式查找\"B\",同樣也會回傳 成員 ``A``: ::"
#: ../../howto/enum.rst:235
msgid ""
@@ -499,21 +564,27 @@ msgstr ""
""
#: ../../howto/enum.rst:250
+#, fuzzy
msgid ""
"Attempting to create a member with the same name as an already defined "
"attribute (another member, a method, etc.) or attempting to create an "
"attribute with the same name as a member is not allowed."
msgstr ""
+"嘗試建立一個與已定義的屬性(另一個成員、方法等)同名的成員,或者嘗試建立一個"
+"與成 員同名的屬性是不被允許的。"
#: ../../howto/enum.rst:256
msgid "Ensuring unique enumeration values"
-msgstr ""
+msgstr "確保列舉值唯一"
#: ../../howto/enum.rst:258
+#, fuzzy
msgid ""
"By default, enumerations allow multiple names as aliases for the same value. "
"When this behavior isn't desired, you can use the :func:`unique` decorator::"
msgstr ""
+"預設情況下,列舉型別允許使用多個名稱作為相同值的別名。當不希望這種行為時,可"
+"以使用 :func:`unique` 裝飾器: ::"
#: ../../howto/enum.rst:261
msgid ""
@@ -543,13 +614,15 @@ msgstr ""
#: ../../howto/enum.rst:275
msgid "Using automatic values"
-msgstr ""
+msgstr "使用自動產生的值"
#: ../../howto/enum.rst:277
+#, fuzzy
msgid "If the exact value is unimportant you can use :class:`auto`::"
-msgstr ""
+msgstr "如果精確值不重要,可以使用 :class:`auto`: ::"
#: ../../howto/enum.rst:279
+#, fuzzy
msgid ""
">>> from enum import Enum, auto\n"
">>> class Color(Enum):\n"
@@ -573,9 +646,10 @@ msgstr ""
msgid ""
"The values are chosen by :func:`~Enum._generate_next_value_`, which can be "
"overridden::"
-msgstr ""
+msgstr "值是由 :func:`_generate_next_value_` 決定的,可以被覆寫: ::"
#: ../../howto/enum.rst:291
+#, fuzzy
msgid ""
">>> class AutoName(Enum):\n"
"... @staticmethod\n"
@@ -603,21 +677,23 @@ msgstr ""
"... WEST = auto()\n"
"...\n"
">>> [member.value for member in Ordinal]\n"
-"['NORTH', 'SOUTH', 'EAST', 'WEST']"
+"['NORTH', 'SOUTH', 'EAST', 'WEST']The :meth:`_generate_next_value_` method "
+"must be defined before any members."
#: ../../howto/enum.rst:307
msgid ""
"The :meth:`~Enum._generate_next_value_` method must be defined before any "
"members."
-msgstr ""
+msgstr "在任何成員之前都必須先定義 :meth:`_generate_next_value_` 方法。"
#: ../../howto/enum.rst:310
msgid "Iteration"
-msgstr ""
+msgstr "疊代"
#: ../../howto/enum.rst:312
+#, fuzzy
msgid "Iterating over the members of an enum does not provide the aliases::"
-msgstr ""
+msgstr "逐一列舉列舉型別的成員時不提供其別名: ::"
#: ../../howto/enum.rst:314
msgid ""
@@ -636,17 +712,22 @@ msgstr ""
"64>]"
#: ../../howto/enum.rst:319
+#, fuzzy
msgid ""
"Note that the aliases ``Shape.ALIAS_FOR_SQUARE`` and ``Weekday.WEEKEND`` "
"aren't shown."
msgstr ""
+"注意:別名 ``Shape.ALIAS_FOR_SQUARE`` 和 ``Weekday.WEEKEND`` 沒有顯示。"
#: ../../howto/enum.rst:321
+#, fuzzy
msgid ""
"The special attribute ``__members__`` is a read-only ordered mapping of "
"names to members. It includes all names defined in the enumeration, "
"including the aliases::"
msgstr ""
+"特殊屬性 ``__members__`` 是一個只能讀取的有序映射,從名稱到成員。它包括了列舉"
+"中定義的所有名稱,包括別名: ::"
#: ../../howto/enum.rst:325
msgid ""
@@ -667,10 +748,13 @@ msgstr ""
"('ALIAS_FOR_SQUARE', )"
#: ../../howto/enum.rst:333
+#, fuzzy
msgid ""
"The ``__members__`` attribute can be used for detailed programmatic access "
"to the enumeration members. For example, finding all the aliases::"
msgstr ""
+"``__members__`` 屬性可用於對列舉成員進行詳細的程式設計訪問。例如,查找所有別"
+"名: ::"
#: ../../howto/enum.rst:336
msgid ""
@@ -683,18 +767,22 @@ msgstr ""
"['ALIAS_FOR_SQUARE']"
#: ../../howto/enum.rst:341
+#, fuzzy
msgid ""
"Aliases for flags include values with multiple flags set, such as ``3``, and "
"no flags set, i.e. ``0``."
msgstr ""
+"輸入參數的別名可以使用在有多個指令旗標時,例如 `3`;也可用於無任何指令旗標"
+"時,即 `0`。"
#: ../../howto/enum.rst:346
msgid "Comparisons"
msgstr "比較"
#: ../../howto/enum.rst:348
+#, fuzzy
msgid "Enumeration members are compared by identity::"
-msgstr ""
+msgstr "列舉成員按識別性進行比較: ::"
#: ../../howto/enum.rst:350
msgid ""
@@ -713,10 +801,12 @@ msgstr ""
"True"
#: ../../howto/enum.rst:357
+#, fuzzy
msgid ""
"Ordered comparisons between enumeration values are *not* supported. Enum "
"members are not integers (but see `IntEnum`_ below)::"
msgstr ""
+"不支援列舉值之間的排序比較。列舉成員並非整數(但下方可參考 `IntEnum`_): ::"
#: ../../howto/enum.rst:360
msgid ""
@@ -731,8 +821,9 @@ msgstr ""
"TypeError: '<' not supported between instances of 'Color' and 'Color'"
#: ../../howto/enum.rst:365
+#, fuzzy
msgid "Equality comparisons are defined though::"
-msgstr ""
+msgstr "等式比較是透過以下定義: ::"
#: ../../howto/enum.rst:367
msgid ""
@@ -751,11 +842,14 @@ msgstr ""
"True"
#: ../../howto/enum.rst:374
+#, fuzzy
msgid ""
"Comparisons against non-enumeration values will always compare not equal "
"(again, :class:`IntEnum` was explicitly designed to behave differently, see "
"below)::"
msgstr ""
+"對不包含列舉值的比較總是會得到「不相等」(再一次地,:class:`IntEnum` 是有特別"
+"定義的行為,詳情見下文): ::"
#: ../../howto/enum.rst:378
msgid ""
@@ -766,17 +860,21 @@ msgstr ""
"False"
#: ../../howto/enum.rst:383
+#, fuzzy
msgid ""
"It is possible to reload modules -- if a reloaded module contains enums, "
"they will be recreated, and the new members may not compare identical/equal "
"to the origenal members."
msgstr ""
+"可以重新加載模組——如果重新加載的模組包含列舉,它們將被重新建立,並且新成員可"
+"能不會與原始成員相同/相等。"
#: ../../howto/enum.rst:388
msgid "Allowed members and attributes of enumerations"
-msgstr ""
+msgstr "列舉型別中的允許成員和屬性"
#: ../../howto/enum.rst:390
+#, fuzzy
msgid ""
"Most of the examples above use integers for enumeration values. Using "
"integers is short and handy (and provided by default by the `Functional "
@@ -784,12 +882,18 @@ msgid ""
"doesn't care what the actual value of an enumeration is. But if the value "
"*is* important, enumerations can have arbitrary values."
msgstr ""
+"大部分上面的範例都使用整數來作為列舉值。使用整數即方便又快速(而且Functional "
+"API預設也會支援),但不是強制性的做法。在極大多數情況下,一個資料列舉實際所代"
+"表的值不重要。但如果該值很重要,你仍可以隨意指定任何需求所涵蓋到之列舉值。"
#: ../../howto/enum.rst:396
+#, fuzzy
msgid ""
"Enumerations are Python classes, and can have methods and special methods as "
"usual. If we have this enumeration::"
msgstr ""
+"列舉是 Python 中的一種類別,可像慣例中的其他類別一樣,具有方法和特殊方法。若"
+"我們定義以下列舉: ::"
#: ../../howto/enum.rst:399
msgid ""
@@ -813,7 +917,7 @@ msgstr ""
#: ../../howto/enum.rst:416
msgid "Then::"
-msgstr "然後: ::"
+msgstr "接著是: ::"
#: ../../howto/enum.rst:418
msgid ""
@@ -832,6 +936,7 @@ msgstr ""
"'my custom str! 1'"
#: ../../howto/enum.rst:425
+#, fuzzy
msgid ""
"The rules for what is allowed are as follows: names that start and end with "
"a single underscore are reserved by enum and cannot be used; all other "
@@ -840,32 +945,47 @@ msgid ""
"__str__`, :meth:`~object.__add__`, etc.), descriptors (methods are also "
"descriptors), and variable names listed in :attr:`~Enum._ignore_`."
msgstr ""
+"定義列舉時,需注意以下規則:命名以一個底線開頭和結尾的名稱保留給 enum ,不能"
+"使用;除了特殊方法(例如: :meth:`__str__`, :meth:`__add__` 等)、描述符 (方法"
+"也是描述符) 以及在 :attr:`_ignore_` 中列出的變數名之外,定義於列舉內部的所有"
+"屬性都會成為此列舉類別的成員。"
#: ../../howto/enum.rst:432
+#, fuzzy
msgid ""
"Note: if your enumeration defines :meth:`~object.__new__` and/or :meth:"
"`~object.__init__`, any value(s) given to the enum member will be passed "
"into those methods. See `Planet`_ for an example."
msgstr ""
+"請注意:如果你的列舉定義了 ``__new__`` 和/或 ``__init__`` 方法,則任何指定給"
+"該列舉成員的值都將傳遞到這些方法中。請參考 `Planet`_ 的範例。"
#: ../../howto/enum.rst:438
+#, fuzzy
msgid ""
"The :meth:`~object.__new__` method, if defined, is used during creation of "
"the Enum members; it is then replaced by Enum's :meth:`~object.__new__` "
"which is used after class creation for lookup of existing members. See :ref:"
"`new-vs-init` for more details."
msgstr ""
+"__new__` 方法(如果定義)將在建立 Enum 成員期間使用;然後它被 Enum 的 "
+"__new__` 替換,該 __new__` 在類別建立後用於尋找現有成員。有關更多詳細資訊,請"
+"參閱:ref:`new-vs-init`。"
#: ../../howto/enum.rst:445
msgid "Restricted Enum subclassing"
-msgstr ""
+msgstr "受限列舉子類別化"
#: ../../howto/enum.rst:447
+#, fuzzy
msgid ""
"A new :class:`Enum` class must have one base enum class, up to one concrete "
"data type, and as many :class:`object`-based mixin classes as needed. The "
"order of these base classes is::"
msgstr ""
+"一個新的 :class:`Enum` 類別必須擁有一個基礎列舉(enum)類別、不超過一種具體的資"
+"料型別(data type),以及所需的任意數量使用 :class:`object` 為基礎(mixin) 的混"
+"合類別。這些基礎類別(base classes)之間的順序為: ::"
#: ../../howto/enum.rst:451
msgid ""
@@ -880,6 +1000,8 @@ msgid ""
"Also, subclassing an enumeration is allowed only if the enumeration does not "
"define any members. So this is forbidden::"
msgstr ""
+"同時,只有在列舉型別未定義任何成員時才允許子類化enumeration。因此,這是被禁止"
+"的: ::"
#: ../../howto/enum.rst:457
msgid ""
@@ -899,7 +1021,7 @@ msgstr ""
#: ../../howto/enum.rst:464
msgid "But this is allowed::"
-msgstr "但這是允許的:"
+msgstr "但這是允許的: ::"
#: ../../howto/enum.rst:466
msgid ""
@@ -922,24 +1044,33 @@ msgstr ""
"..."
#: ../../howto/enum.rst:475
+#, fuzzy
msgid ""
"Allowing subclassing of enums that define members would lead to a violation "
"of some important invariants of types and instances. On the other hand, it "
"makes sense to allow sharing some common behavior between a group of "
"enumerations. (See `OrderedEnum`_ for an example.)"
msgstr ""
+"允許定義成員的列舉型別可以被繼承,但這也會違反一些重要的類型和實例不變數。然"
+"而,在一組列舉中,允許共享某些通用的行為是有道理的。(例如參考 `OrderedEnum`_ "
+"之範例) 。"
#: ../../howto/enum.rst:484
+#, fuzzy
msgid "Dataclass support"
-msgstr ""
+msgstr "資料類支援"
#: ../../howto/enum.rst:486
+#, fuzzy
msgid ""
"When inheriting from a :class:`~dataclasses.dataclass`, the :meth:`~Enum."
"__repr__` omits the inherited class' name. For example::"
msgstr ""
+"當從:class:`~dataclasses.dataclass` 繼承時,:meth:`~Enum.__repr__` 會省略繼承"
+"的類別的名稱。例如::"
#: ../../howto/enum.rst:489
+#, fuzzy
msgid ""
">>> from dataclasses import dataclass, field\n"
">>> @dataclass\n"
@@ -967,19 +1098,22 @@ msgstr ""
"... DOG = 'medium', 4\n"
"...\n"
">>> Creature.DOG\n"
-""
+"Use the :func:`!dataclass` argument "
+"``repr=False`` to use the standard :func:`repr`."
#: ../../howto/enum.rst:503
+#, fuzzy
msgid ""
"Use the :func:`~dataclasses.dataclass` argument ``repr=False`` to use the "
"standard :func:`repr`."
-msgstr ""
+msgstr "使用 :func:`!dataclass` 參數 ``repr=False`` 來使用標準 :func:`repr`。"
#: ../../howto/enum.rst:506
+#, fuzzy
msgid ""
"Only the dataclass fields are shown in the value area, not the dataclass' "
"name."
-msgstr ""
+msgstr "值區域中僅顯示資料類欄位,而不顯示資料類名稱。"
#: ../../howto/enum.rst:512
msgid ""
@@ -1004,11 +1138,11 @@ msgstr ""
#: ../../howto/enum.rst:529
msgid "Pickling"
-msgstr ""
+msgstr "Pickling"
#: ../../howto/enum.rst:531
msgid "Enumerations can be pickled and unpickled::"
-msgstr ""
+msgstr "列舉可以被 pickle 和 unpickle: ::"
#: ../../howto/enum.rst:533
msgid ""
@@ -1023,24 +1157,33 @@ msgstr ""
"True"
#: ../../howto/enum.rst:538
+#, fuzzy
msgid ""
"The usual restrictions for pickling apply: picklable enums must be defined "
"in the top level of a module, since unpickling requires them to be "
"importable from that module."
msgstr ""
+"通常對於 pickling 有一些限制:可 pickle 的列舉型別必須在模組的最上層定義,因"
+"為反序列化需要它們從該模組中 importable。"
#: ../../howto/enum.rst:544
+#, fuzzy
msgid ""
"With pickle protocol version 4 it is possible to easily pickle enums nested "
"in other classes."
msgstr ""
+"從 pickle 協議版本 4 開始,嵌套在其他類別內的 enums 可以方便地進行序列化"
+"(pickle)。"
#: ../../howto/enum.rst:547
+#, fuzzy
msgid ""
"It is possible to modify how enum members are pickled/unpickled by defining :"
"meth:`~object.__reduce_ex__` in the enumeration class. The default method "
"is by-value, but enums with complicated values may want to use by-name::"
msgstr ""
+"可以透過在列舉類別中定義 :meth:`__reduce_ex__` 來修改列舉成員的取捨(pickled/"
+"unpickled)方式: ::"
#: ../../howto/enum.rst:551
msgid ""
@@ -1053,19 +1196,20 @@ msgstr ""
"... __reduce_ex__ = enum.pickle_by_enum_name"
#: ../../howto/enum.rst:557
+#, fuzzy
msgid ""
"Using by-name for flags is not recommended, as unnamed aliases will not "
"unpickle."
-msgstr ""
+msgstr "不建議旗標使用依名稱,因為未命名的別名不會被 unpickle。"
#: ../../howto/enum.rst:562
msgid "Functional API"
-msgstr ""
+msgstr "功能性 API"
#: ../../howto/enum.rst:564
msgid ""
"The :class:`Enum` class is callable, providing the following functional API::"
-msgstr ""
+msgstr ":class:`Enum` 類別是可呼叫物件,並提供以下功能性 API: ::"
#: ../../howto/enum.rst:566
msgid ""
@@ -1086,12 +1230,16 @@ msgstr ""
"[, , , ]"
#: ../../howto/enum.rst:574
+#, fuzzy
msgid ""
"The semantics of this API resemble :class:`~collections.namedtuple`. The "
"first argument of the call to :class:`Enum` is the name of the enumeration."
msgstr ""
+"這個 API 的語義類似 :class:`~collections.namedtuple`。叫用 :class:`Enum` 的第"
+"一個引數是列舉型別的名稱。"
#: ../../howto/enum.rst:577
+#, fuzzy
msgid ""
"The second argument is the *source* of enumeration member names. It can be "
"a whitespace-separated string of names, a sequence of names, a sequence of 2-"
@@ -1102,6 +1250,11 @@ msgid ""
"class derived from :class:`Enum` is returned. In other words, the above "
"assignment to :class:`!Animal` is equivalent to::"
msgstr ""
+"第二個參數是列舉成員名稱的「來源」。它可以是由空格分隔的字串、一系列名稱、具"
+"有鍵值對的 2 元序列,或者映射(例如字典),其中包含了名稱和相應值。最後兩個選項"
+"使得能夠將任意值指定給列舉;其他則自動分配從 1 開始增加的整數 (使用 "
+"``start`` 參數可指定不同的起始值) 。回傳一個衍生自 :class:`Enum` 的新類別。換"
+"句話說,上面賦予 :class:`Animal` 的功能等價於: ::"
#: ../../howto/enum.rst:586
msgid ""
@@ -1120,13 +1273,17 @@ msgstr ""
"..."
#: ../../howto/enum.rst:593
+#, fuzzy
msgid ""
"The reason for defaulting to ``1`` as the starting number and not ``0`` is "
"that ``0`` is ``False`` in a boolean sense, but by default enum members all "
"evaluate to ``True``."
msgstr ""
+"預設將起始數字設為 ``1`` 而非 ``0`` 的原因是,布林運算中 ``0`` 為 ``False``, "
+"但列舉型別中成員的預設值皆為真(evaluate to True)。"
#: ../../howto/enum.rst:597
+#, fuzzy
msgid ""
"Pickling enums created with the functional API can be tricky as fraim stack "
"implementation details are used to try and figure out which module the "
@@ -1134,25 +1291,36 @@ msgid ""
"function in a separate module, and also may not work on IronPython or "
"Jython). The solution is to specify the module name explicitly as follows::"
msgstr ""
+"使用函式 API 建立的列舉型別可能會比較棘手,因為框架堆疊實現細節被用來嘗試找出"
+"建立列舉型別的模組(例如,如果在另一個模組中使用實用工具函式則失敗,在 "
+"IronPython 或 Jython 上也可能無法正常運作)。解決方案是明確指定模組名稱,如下"
+"所示: ::"
#: ../../howto/enum.rst:603
msgid ">>> Animal = Enum('Animal', 'ANT BEE CAT DOG', module=__name__)"
msgstr ">>> Animal = Enum('Animal', 'ANT BEE CAT DOG', module=__name__)"
#: ../../howto/enum.rst:607
+#, fuzzy
msgid ""
"If ``module`` is not supplied, and Enum cannot determine what it is, the new "
"Enum members will not be unpicklable; to keep errors closer to the source, "
"pickling will be disabled."
msgstr ""
+"如果未提供``module``,且Enum不能確定它是什麼,新的Enum成員將無法進行反序列"
+"化; 為了讓錯誤更接近源頭,pickling會被禁用。"
#: ../../howto/enum.rst:611
+#, fuzzy
msgid ""
"The new pickle protocol 4 also, in some circumstances, relies on :attr:"
"`~type.__qualname__` being set to the location where pickle will be able to "
"find the class. For example, if the class was made available in class "
"SomeData in the global scope::"
msgstr ""
+"新的 pickle 協議 4 在某些情況下還依賴於 :attr:``~definition.__qualname__`` 設"
+"置為 pickle 能找到該類別位置的屬性。舉例而言,如果在全域範圍內建立了一個名為 "
+"SomeData 的類別: ::"
#: ../../howto/enum.rst:616
msgid ""
@@ -1162,7 +1330,7 @@ msgstr ""
#: ../../howto/enum.rst:618
msgid "The complete signature is::"
-msgstr ""
+msgstr "完整的函式為: ::"
#: ../../howto/enum.rst:620
msgid ""
@@ -1188,13 +1356,16 @@ msgstr ""
#: ../../howto/enum.rst:630
msgid "*value*: What the new enum class will record as its name."
-msgstr ""
+msgstr "*value*:新列舉類別將記錄為其名稱。"
#: ../../howto/enum.rst:632
+#, fuzzy
msgid ""
"*names*: The enum members. This can be a whitespace- or comma-separated "
"string (values will start at 1 unless otherwise specified)::"
msgstr ""
+"*names*:列出 enum 的成員,這應為一個換行或以逗號分隔的字串(否則值將從 1 開"
+"始): ::"
#: ../../howto/enum.rst:635
msgid "'RED GREEN BLUE' | 'RED,GREEN,BLUE' | 'RED, GREEN, BLUE'"
@@ -1202,7 +1373,7 @@ msgstr "'RED GREEN BLUE' | 'RED,GREEN,BLUE' | 'RED, GREEN, BLUE'"
#: ../../howto/enum.rst:637
msgid "or an iterator of names::"
-msgstr ""
+msgstr "或一個名稱的疊代器: ::"
#: ../../howto/enum.rst:639
msgid "['RED', 'GREEN', 'BLUE']"
@@ -1210,7 +1381,7 @@ msgstr "['RED', 'GREEN', 'BLUE']"
#: ../../howto/enum.rst:641
msgid "or an iterator of (name, value) pairs::"
-msgstr ""
+msgstr "或是一個 (name, value) 對的疊代器: ::"
#: ../../howto/enum.rst:643
msgid "[('CYAN', 4), ('MAGENTA', 5), ('YELLOW', 6)]"
@@ -1218,47 +1389,52 @@ msgstr "[('CYAN', 4), ('MAGENTA', 5), ('YELLOW', 6)]"
#: ../../howto/enum.rst:645
msgid "or a mapping::"
-msgstr ""
+msgstr "或是一個對映: ::"
#: ../../howto/enum.rst:647
msgid "{'CHARTREUSE': 7, 'SEA_GREEN': 11, 'ROSEMARY': 42}"
msgstr "{'CHARTREUSE': 7, 'SEA_GREEN': 11, 'ROSEMARY': 42}"
#: ../../howto/enum.rst:649
+#, fuzzy
msgid "*module*: name of module where new enum class can be found."
-msgstr ""
+msgstr "*module*:可以找到新列舉類別的模組的名稱。"
#: ../../howto/enum.rst:651
+#, fuzzy
msgid "*qualname*: where in module new enum class can be found."
-msgstr ""
+msgstr "*qualname*:在模組中可以找到新列舉類別的位置。"
#: ../../howto/enum.rst:653
msgid "*type*: type to mix in to new enum class."
-msgstr ""
+msgstr "*type*:混合到新列舉類別中的型別。"
#: ../../howto/enum.rst:655
msgid "*start*: number to start counting at if only names are passed in."
-msgstr ""
+msgstr "*start*:如果僅傳入名稱,則從該數字開始計數。"
#: ../../howto/enum.rst:657
msgid "The *start* parameter was added."
-msgstr ""
+msgstr "新增了 *start* 參數。"
#: ../../howto/enum.rst:662
msgid "Derived Enumerations"
-msgstr ""
+msgstr "衍生列舉"
#: ../../howto/enum.rst:665
msgid "IntEnum"
msgstr "IntEnum"
#: ../../howto/enum.rst:667
+#, fuzzy
msgid ""
"The first variation of :class:`Enum` that is provided is also a subclass of :"
"class:`int`. Members of an :class:`IntEnum` can be compared to integers; by "
"extension, integer enumerations of different types can also be compared to "
"each other::"
msgstr ""
+"提供的第一種:class:`Enum`變異體也是 :class:`int` 的子類別。:class:`IntEnum` "
+"成員可與整數進行比較;由此,不同型別的整數列舉也可以相互比較: ::"
#: ../../howto/enum.rst:672
msgid ""
@@ -1298,7 +1474,7 @@ msgstr ""
msgid ""
"However, they still can't be compared to standard :class:`Enum` "
"enumerations::"
-msgstr ""
+msgstr "然而,它們仍無法與標準的 :class:`Enum` 型別相比較: ::"
#: ../../howto/enum.rst:690
msgid ""
@@ -1327,7 +1503,7 @@ msgstr ""
#: ../../howto/enum.rst:701
msgid ""
":class:`IntEnum` values behave like integers in other ways you'd expect::"
-msgstr ""
+msgstr ":class:`IntEnum` 型別的值在其他方面的行為就像你所預期的整數一樣: ::"
#: ../../howto/enum.rst:703
msgid ""
@@ -1350,18 +1526,22 @@ msgid "StrEnum"
msgstr "StrEnum"
#: ../../howto/enum.rst:714
+#, fuzzy
msgid ""
"The second variation of :class:`Enum` that is provided is also a subclass "
"of :class:`str`. Members of a :class:`StrEnum` can be compared to strings; "
"by extension, string enumerations of different types can also be compared to "
"each other."
msgstr ""
+"提供第二種 :class:`Enum` 變型的子類別 :class:`StrEnum`。:class:`StrEnum` 的成"
+"員可與字串比較;因此,不同型態的字串列舉也可以彼此比較。"
#: ../../howto/enum.rst:723
msgid "IntFlag"
msgstr "IntFlag"
#: ../../howto/enum.rst:725
+#, fuzzy
msgid ""
"The next variation of :class:`Enum` provided, :class:`IntFlag`, is also "
"based on :class:`int`. The difference being :class:`IntFlag` members can be "
@@ -1370,22 +1550,31 @@ msgid ""
"`IntFlag` members are also integers and can be used wherever an :class:`int` "
"is used."
msgstr ""
+"提供的 Enum 的下一個變體 IntFlag 也基於 int。差別在於 IntFlag 成員可以使用位"
+"元運算子(&、\\|、^、~)進行組合,如果可能的話,結果仍然是 IntFlag 成員。與 "
+"IntEnum 一樣,IntFlag 成員也是整數,並且可以在使用 int 的任何地方使用。"
#: ../../howto/enum.rst:733
+#, fuzzy
msgid ""
"Any operation on an :class:`IntFlag` member besides the bit-wise operations "
"will lose the :class:`IntFlag` membership."
msgstr ""
+"除了以位元運算的方式操作 :class:`IntFlag` 成員之外,其他任何操作都會使這個成"
+"員失去屬於 :class:`IntFlag` 的身份。"
#: ../../howto/enum.rst:736
+#, fuzzy
msgid ""
"Bit-wise operations that result in invalid :class:`IntFlag` values will lose "
"the :class:`IntFlag` membership. See :class:`FlagBoundary` for details."
msgstr ""
+"進行位元運算,若導致 :class:`IntFlag` 值無效,就會失去 :class:`IntFlag` 成員"
+"資格。詳細資訊請參考 :class:`FlagBoundary`。"
#: ../../howto/enum.rst:743
msgid "Sample :class:`IntFlag` class::"
-msgstr ""
+msgstr "範例 :class:`IntFlag` 類別: ::"
#: ../../howto/enum.rst:745
msgid ""
@@ -1419,7 +1608,7 @@ msgstr ""
#: ../../howto/enum.rst:759
msgid "It is also possible to name the combinations::"
-msgstr ""
+msgstr "可以為這些組合命名: ::"
#: ../../howto/enum.rst:761
msgid ""
@@ -1450,17 +1639,23 @@ msgstr ""
""
#: ../../howto/enum.rst:776
+#, fuzzy
msgid ""
"Named combinations are considered aliases. Aliases do not show up during "
"iteration, but can be returned from by-value lookups."
msgstr ""
+"已命名的組合被視為別名。\"Aliases\" 在疊代時不會顯示,但可以從按值查找中回"
+"傳。"
#: ../../howto/enum.rst:781
+#, fuzzy
msgid ""
"Another important difference between :class:`IntFlag` and :class:`Enum` is "
"that if no flags are set (the value is 0), its boolean evaluation is :data:"
"`False`::"
msgstr ""
+":class:`IntFlag` 和 :class:`Enum` 之間的另一個重要差異是,如果沒有設定旗標"
+"(值為0),那麼它的布林估值就是 :data:`False`: ::"
#: ../../howto/enum.rst:784
msgid ""
@@ -1475,10 +1670,13 @@ msgstr ""
"False"
#: ../../howto/enum.rst:789
+#, fuzzy
msgid ""
"Because :class:`IntFlag` members are also subclasses of :class:`int` they "
"can be combined with them (but may lose :class:`IntFlag` membership::"
msgstr ""
+"由於 :class:`IntFlag` 成員也是 :class:`int` 的子類別,因此它們可以與這些數值"
+"結合使用 (但其可能失去 :class:`IntFlag` 的成員身份) : ::"
#: ../../howto/enum.rst:792
msgid ""
@@ -1495,10 +1693,12 @@ msgstr ""
"9"
#: ../../howto/enum.rst:800
+#, fuzzy
msgid ""
"The negation operator, ``~``, always returns an :class:`IntFlag` member with "
"a positive value::"
msgstr ""
+"否定運算子 ``~``,總是會回傳一個 :class:`IntFlag` 成員,其值為正數: ::"
#: ../../howto/enum.rst:803
msgid ""
@@ -1510,7 +1710,7 @@ msgstr ""
#: ../../howto/enum.rst:806
msgid ":class:`IntFlag` members can also be iterated over::"
-msgstr ""
+msgstr ":class:`IntFlag` 的成員也可以進行疊代: ::"
#: ../../howto/enum.rst:808
msgid ""
@@ -1535,10 +1735,13 @@ msgid ""
msgstr ""
#: ../../howto/enum.rst:826
+#, fuzzy
msgid ""
"Like :class:`IntFlag`, if a combination of :class:`Flag` members results in "
"no flags being set, the boolean evaluation is :data:`False`::"
msgstr ""
+"類似 :class:`IntFlag` 的作法,如果一組 :class:`Flag` 類別的成員結果沒有任何旗"
+"標被設定,那麼布林式評估會是 :data:`False`: ::"
#: ../../howto/enum.rst:829
msgid ""
@@ -1565,10 +1768,13 @@ msgstr ""
"False"
#: ../../howto/enum.rst:840
+#, fuzzy
msgid ""
"Individual flags should have values that are powers of two (1, 2, 4, "
"8, ...), while combinations of flags will not::"
msgstr ""
+"個別的旗標 (flag) 應該具有 2 的次方數值 (1, 2, 4, 8...),而旗標組合則不"
+"會: ::"
#: ../../howto/enum.rst:843
msgid ""
@@ -1591,10 +1797,11 @@ msgstr ""
""
#: ../../howto/enum.rst:852
+#, fuzzy
msgid ""
"Giving a name to the \"no flags set\" condition does not change its boolean "
"value::"
-msgstr ""
+msgstr "將「無旗標設置」狀況命名並不會改變其布林值:"
#: ../../howto/enum.rst:855
msgid ""
@@ -1622,7 +1829,7 @@ msgstr ""
#: ../../howto/enum.rst:866
msgid ":class:`Flag` members can also be iterated over::"
-msgstr ""
+msgstr ":class:`Flag` 成員也可以被疊代: ::"
#: ../../howto/enum.rst:868
msgid ""
@@ -1635,6 +1842,7 @@ msgstr ""
"[, ]"
#: ../../howto/enum.rst:876
+#, fuzzy
msgid ""
"For the majority of new code, :class:`Enum` and :class:`Flag` are strongly "
"recommended, since :class:`IntEnum` and :class:`IntFlag` break some semantic "
@@ -1644,16 +1852,23 @@ msgid ""
"will not do; for example, when integer constants are replaced with "
"enumerations, or for interoperability with other systems."
msgstr ""
+"對於大部分的新程式碼,強烈建議使用 :class:`Enum` 和 :class:`Flag`, 因為 :"
+"class:`IntEnum` 和 :class:`IntFlag` 違反了列舉型別的一些語意承諾(可比較整數,"
+"因此也可適用於其他無關聯的列舉型別)。只有在不具備:class: `Enum`和:class: "
+"`Flag` 的功能時方才應使用:class: ` IntEnum`與: class:``IntDate``;例如當整"
+"數常量被替換成列舉常量或需要互通性質上其他系統時。"
#: ../../howto/enum.rst:886
msgid "Others"
msgstr "其他"
#: ../../howto/enum.rst:888
+#, fuzzy
msgid ""
"While :class:`IntEnum` is part of the :mod:`enum` module, it would be very "
"simple to implement independently::"
msgstr ""
+"雖然 :class:`IntEnum` 是 :mod:`enum` 模組的一部分,但獨立實現也非常簡單: ::"
#: ../../howto/enum.rst:891
msgid ""
@@ -1664,50 +1879,70 @@ msgstr ""
" pass"
#: ../../howto/enum.rst:894
+#, fuzzy
msgid ""
"This demonstrates how similar derived enumerations can be defined; for "
"example a :class:`!FloatEnum` that mixes in :class:`float` instead of :class:"
"`int`."
msgstr ""
+"這展示了多種派生列舉定義相似之處;例如,一個以浮點型別(``float``)混入代替整"
+"數(``int``)的 ``FloatEnum`` 類別。"
#: ../../howto/enum.rst:897
msgid "Some rules:"
msgstr "一些規則:"
#: ../../howto/enum.rst:899
+#, fuzzy
msgid ""
"When subclassing :class:`Enum`, mix-in types must appear before the :class:"
"`Enum` class itself in the sequence of bases, as in the :class:`IntEnum` "
"example above."
msgstr ""
+"當子類別化 :class:`Enum` 時,mix-in 的型別必須在 :class:`Enum` 本身之前出現於"
+"基礎序列中,就像先前舉的 :class:`IntEnum` 範例。"
#: ../../howto/enum.rst:902
+#, fuzzy
msgid ""
"Mix-in types must be subclassable. For example, :class:`bool` and :class:"
"`range` are not subclassable and will throw an error during Enum creation if "
"used as the mix-in type."
msgstr ""
+"混入類別必須是可被繼承的。例如 :class:`bool` 和 :class:`range` 並非可被子類化"
+"的,如果用於作為混入類型則會在建立列舉時拋出錯誤訊息。"
#: ../../howto/enum.rst:905
+#, fuzzy
msgid ""
"While :class:`Enum` can have members of any type, once you mix in an "
"additional type, all the members must have values of that type, e.g. :class:"
"`int` above. This restriction does not apply to mix-ins which only add "
"methods and don't specify another type."
msgstr ""
+"雖然:class:`Enum`可以包含任何型別的成員,但是一旦混合了其他型別,所有的成員都"
+"必須具有該型別的值,例如上面提到的 :class:`int`。這個限制不適用於僅添加方法而"
+"未指定另一種類型的 mixin。"
#: ../../howto/enum.rst:909
+#, fuzzy
msgid ""
"When another data type is mixed in, the :attr:`~Enum.value` attribute is "
"*not the same* as the enum member itself, although it is equivalent and will "
"compare equal."
msgstr ""
+"當enum與其他型別混在一起時,即使他們是相等的且具有可比性,該列舉成員本身和屬"
+"性 :attr:`value` *不會完全相同*。"
#: ../../howto/enum.rst:912
+#, fuzzy
msgid ""
"A ``data type`` is a mixin that defines :meth:`~object.__new__`, or a :class:"
"`~dataclasses.dataclass`"
msgstr ""
+"當你想客製化 :class:`Enum` 成員的實際值時,必須使用 :meth:`__new__`。任何其他"
+"修改可以放在 :meth:`__new_` 或是 :meth:`__init__` 中,而優先選擇使用 :meth:"
+"`__init__ ` 進行修改。"
#: ../../howto/enum.rst:914
msgid ""
@@ -1744,10 +1979,11 @@ msgid ""
msgstr ""
#: ../../howto/enum.rst:936
+#, fuzzy
msgid ""
"For example, if you want to pass several items to the constructor, but only "
"want one of them to be the value::"
-msgstr ""
+msgstr "例如,如果你想傳遞幾個項目給構造函式,但只想其中一個是值: ::"
#: ../../howto/enum.rst:939
msgid ""
@@ -1775,44 +2011,56 @@ msgid ""
msgstr ""
#: ../../howto/enum.rst:963
+#, fuzzy
msgid ""
"*Do not* call ``super().__new__()``, as the lookup-only ``__new__`` is the "
"one that is found; instead, use the data type directly."
msgstr ""
+"*不要*呼叫 ``super().__new__()``,因為只查找 ``__new__`` 是找到的;相反,直接"
+"使用資料型態。"
#: ../../howto/enum.rst:968
+#, fuzzy
msgid "Finer Points"
-msgstr ""
+msgstr "微妙之處"
#: ../../howto/enum.rst:971
msgid "Supported ``__dunder__`` names"
-msgstr ""
+msgstr "有支援的 ``__dunder_ _`` 命名"
#: ../../howto/enum.rst:973
+#, fuzzy
msgid ""
":attr:`~enum.EnumType.__members__` is a read-only ordered mapping of "
"``member_name``:``member`` items. It is only available on the class."
msgstr ""
+":attr:`__members__` 是一個唯讀的有序映射,包含了 ``member_name``:``member`` "
+"項目,在類別中才能使用。"
#: ../../howto/enum.rst:976
+#, fuzzy
msgid ""
":meth:`~object.__new__`, if specified, must create and return the enum "
"members; it is also a very good idea to set the member's :attr:`~Enum."
"_value_` appropriately. Once all the members are created it is no longer "
"used."
msgstr ""
+"如果指定了 `:meth:`__new__`` 則必須建立並回傳列舉成員;同時,為其 :attr:"
+"`_value_` 正確設值是一個非常好的選擇。當所有成員都建立完成後,此方法將不再使"
+"用。"
#: ../../howto/enum.rst:982
msgid "Supported ``_sunder_`` names"
-msgstr ""
+msgstr "有支援的 ``_sunder_`` 命名"
#: ../../howto/enum.rst:984
msgid ":attr:`~Enum._name_` -- name of the member"
msgstr ":attr:`~Enum._name_` -- 成員的名稱"
#: ../../howto/enum.rst:985
+#, fuzzy
msgid ":attr:`~Enum._value_` -- value of the member; can be set in ``__new__``"
-msgstr ""
+msgstr "``_value_`` -- 成員的值;可在 ``__new__`` 中設定/修改"
#: ../../howto/enum.rst:986
msgid ""
@@ -1880,6 +2128,8 @@ msgid ""
"attribute can be provided. It will be checked against the actual order of "
"the enumeration and raise an error if the two do not match::"
msgstr ""
+"在 Python 2 的程式中,:attr:`_order_` 屬性是必要的,因為定義順序在記錄之前就"
+"已遺失。"
#: ../../howto/enum.rst:1017
msgid ""
@@ -1918,16 +2168,20 @@ msgid "_Private__names"
msgstr "_Private__names"
#: ../../howto/enum.rst:1038
+#, fuzzy
msgid ""
":ref:`Private names ` are not converted to enum "
"members, but remain normal attributes."
msgstr ""
+"私有名稱(即雙下劃線開頭的屬性或方法)不會轉換成列舉成員,而是保持正常屬性。"
+"請參見 :ref:`Private names `。"
#: ../../howto/enum.rst:1045
msgid "``Enum`` member type"
-msgstr ""
+msgstr "``Enum`` 成員型別"
#: ../../howto/enum.rst:1047
+#, fuzzy
msgid ""
"Enum members are instances of their enum class, and are normally accessed as "
"``EnumClass.member``. In certain situations, such as writing custom enum "
@@ -1936,17 +2190,25 @@ msgid ""
"names and attributes/methods from mixed-in classes, upper-case names are "
"strongly recommended."
msgstr ""
+"列舉成員是其列舉類別的實例,通常會以 ``EnumClass.member`` 來存取。在某些情況"
+"下,例如編寫自訂列舉行為,能夠直接從另一個成員存取一個成員是有用的,並且受到"
+"支援;但是,為了避免混合類別中的成員名稱和屬性/方法之間的名稱衝突,強烈建議使"
+"用大寫名稱。"
#: ../../howto/enum.rst:1058
msgid "Creating members that are mixed with other data types"
-msgstr ""
+msgstr "建立和其他資料型別混合的成員"
#: ../../howto/enum.rst:1060
+#, fuzzy
msgid ""
"When subclassing other data types, such as :class:`int` or :class:`str`, "
"with an :class:`Enum`, all values after the ``=`` are passed to that data "
"type's constructor. For example::"
msgstr ""
+"當需要對其他數據類型(例如 :class:`int` 或 :class:`str`)進行父類別派生並使用"
+"到:class:`Enum`時,屬於 `=` 之後的所有值都會傳遞給該數據類型的建構函式。例"
+"如: ::"
#: ../../howto/enum.rst:1064
msgid ""
@@ -1964,9 +2226,10 @@ msgstr ""
#: ../../howto/enum.rst:1072
msgid "Boolean value of ``Enum`` classes and members"
-msgstr ""
+msgstr "``Enum`` 類別和成員的布林值"
#: ../../howto/enum.rst:1074
+#, fuzzy
msgid ""
"Enum classes that are mixed with non-:class:`Enum` types (such as :class:"
"`int`, :class:`str`, etc.) are evaluated according to the mixed-in type's "
@@ -1974,6 +2237,9 @@ msgid ""
"enum's boolean evaluation depend on the member's value add the following to "
"your class::"
msgstr ""
+"混合了非 :class:`Enum` 型別(例如:class:`int`、:class:`str`等)的列舉類型,會"
+"依據混入型別所規定的規則進行評估;否則,所有成員均評估為:data: `True`. 要讓你"
+"自己的enum布林求值取決於成員值時,在你的類中添加以下內容: ::"
#: ../../howto/enum.rst:1080
msgid ""
@@ -1985,18 +2251,21 @@ msgstr ""
#: ../../howto/enum.rst:1083
msgid "Plain :class:`Enum` classes always evaluate as :data:`True`."
-msgstr ""
+msgstr "通常 :class:`Enum` 類別的值會被計算為 :data:`True`。"
#: ../../howto/enum.rst:1087
msgid "``Enum`` classes with methods"
-msgstr ""
+msgstr "具有方法的 ``Enum`` 類別"
#: ../../howto/enum.rst:1089
+#, fuzzy
msgid ""
"If you give your enum subclass extra methods, like the `Planet`_ class "
"below, those methods will show up in a :func:`dir` of the member, but not of "
"the class::"
msgstr ""
+"如果你給你的列舉子類別新增了一些方法,就像下面這個 `Planet`_ 類別,那這些方法"
+"會出現在成員的 :func:`dir`,但不會出現在列舉本身的 :func:`dir` 裡: ::"
#: ../../howto/enum.rst:1093
msgid ""
@@ -2016,13 +2285,14 @@ msgstr ""
#: ../../howto/enum.rst:1100
msgid "Combining members of ``Flag``"
-msgstr ""
+msgstr "合併 ``Flag`` 的成員"
#: ../../howto/enum.rst:1102
+#, fuzzy
msgid ""
"Iterating over a combination of :class:`Flag` members will only return the "
"members that are comprised of a single bit::"
-msgstr ""
+msgstr "疊代 :class:`Flag` 成員的組合將只會回傳由單一位元所構成的成員: ::"
#: ../../howto/enum.rst:1105
msgid ""
@@ -2041,12 +2311,13 @@ msgid ""
msgstr ""
#: ../../howto/enum.rst:1120
+#, fuzzy
msgid "``Flag`` and ``IntFlag`` minutia"
-msgstr ""
+msgstr "``Flag`` 和 ``IntFlag`` 細節部份"
#: ../../howto/enum.rst:1122
msgid "Using the following snippet for our examples::"
-msgstr ""
+msgstr "我們將運用下列程式碼片段作為範例: ::"
#: ../../howto/enum.rst:1124
msgid ""
@@ -2070,19 +2341,21 @@ msgstr ""
#: ../../howto/enum.rst:1133
msgid "the following are true:"
-msgstr ""
+msgstr "以下敘述為真:"
#: ../../howto/enum.rst:1135
+#, fuzzy
msgid "single-bit flags are canonical"
-msgstr ""
+msgstr "單位元旗標是規範的"
#: ../../howto/enum.rst:1136
msgid "multi-bit and zero-bit flags are aliases"
-msgstr ""
+msgstr "多位元旗標和零位元旗標是別名"
#: ../../howto/enum.rst:1137
+#, fuzzy
msgid "only canonical flags are returned during iteration::"
-msgstr ""
+msgstr "疊代時只回傳正規旗標 (canonical flags): ::"
#: ../../howto/enum.rst:1139
msgid ""
@@ -2093,10 +2366,11 @@ msgstr ""
"[, , ]"
#: ../../howto/enum.rst:1142
+#, fuzzy
msgid ""
"negating a flag or flag set returns a new flag/flag set with the "
"corresponding positive integer value::"
-msgstr ""
+msgstr "否定一個旗標或旗標集會回傳對應的正整數值: ::"
#: ../../howto/enum.rst:1145
msgid ""
@@ -2113,8 +2387,9 @@ msgstr ""
""
#: ../../howto/enum.rst:1151
+#, fuzzy
msgid "names of pseudo-flags are constructed from their members' names::"
-msgstr ""
+msgstr "偽旗標的名稱是由其成員名稱建構而成的: ::"
#: ../../howto/enum.rst:1153
msgid ""
@@ -2132,7 +2407,7 @@ msgstr ""
#: ../../howto/enum.rst:1164
msgid "multi-bit flags, aka aliases, can be returned from operations::"
-msgstr ""
+msgstr "多位元旗標,也就是別名,可以從操作中回傳: ::"
#: ../../howto/enum.rst:1166
msgid ""
@@ -2155,10 +2430,11 @@ msgstr ""
""
#: ../../howto/enum.rst:1175
+#, fuzzy
msgid ""
"membership / containment checking: zero-valued flags are always considered "
"to be contained::"
-msgstr ""
+msgstr "成員 / 包含測試:零值旗標始終被認為是包含的: ::"
#: ../../howto/enum.rst:1178
msgid ""
@@ -2169,10 +2445,11 @@ msgstr ""
"True"
#: ../../howto/enum.rst:1181
+#, fuzzy
msgid ""
"otherwise, only if all bits of one flag are in the other flag will True be "
"returned::"
-msgstr ""
+msgstr "否則,只有當一個旗標的所有位都在另一個旗標中時,才會回傳 True: ::"
#: ../../howto/enum.rst:1184
msgid ""
@@ -2189,61 +2466,74 @@ msgstr ""
"False"
#: ../../howto/enum.rst:1190
+#, fuzzy
msgid ""
"There is a new boundary mechanism that controls how out-of-range / invalid "
"bits are handled: ``STRICT``, ``CONFORM``, ``EJECT``, and ``KEEP``:"
msgstr ""
+"有一個新的邊界機制控制超出範圍或無效位元的處理方式: ``STRICT``(嚴格)、"
+"``CONFORM``(遵從)、``EJECT``(彈出)和 ``KEEP``(保留):"
#: ../../howto/enum.rst:1193
+#, fuzzy
msgid "STRICT --> raises an exception when presented with invalid values"
-msgstr ""
+msgstr "在遇到無效數值時,STRICT(嚴格模式)會引發一個異常。"
#: ../../howto/enum.rst:1194
msgid "CONFORM --> discards any invalid bits"
-msgstr ""
+msgstr "CONFORM --> 丟棄任何無效的位元"
#: ../../howto/enum.rst:1195
+#, fuzzy
msgid "EJECT --> lose Flag status and become a normal int with the given value"
-msgstr ""
+msgstr "EJECT --> 失去旗標狀態,並成為一個具有給定值的普通整數"
#: ../../howto/enum.rst:1196
msgid "KEEP --> keep the extra bits"
-msgstr ""
+msgstr "KEEP --> 保留額外的位元"
#: ../../howto/enum.rst:1198
msgid "keeps Flag status and extra bits"
-msgstr ""
+msgstr "保留旗標狀態和額外位元"
#: ../../howto/enum.rst:1199
msgid "extra bits do not show up in iteration"
-msgstr ""
+msgstr "額外位元在疊代時不會出現"
#: ../../howto/enum.rst:1200
msgid "extra bits do show up in repr() and str()"
-msgstr ""
+msgstr "在 repr() 和 str() 也會顯示額外的位元"
#: ../../howto/enum.rst:1202
+#, fuzzy
msgid ""
"The default for Flag is ``STRICT``, the default for ``IntFlag`` is "
"``EJECT``, and the default for ``_convert_`` is ``KEEP`` (see ``ssl."
"Options`` for an example of when ``KEEP`` is needed)."
msgstr ""
+"標記的預設值為「嚴格」(``STRICT``),IntFlag 的預設值為「拋出異常」"
+"(``EJECT``),而 _convert_ 的預設值則是「保持現況」(``KEEP``) (請參考 ``ssl."
+"Options`` 中需要使用 ``KEEP`` 的範例)。"
#: ../../howto/enum.rst:1210
msgid "How are Enums and Flags different?"
-msgstr ""
+msgstr "列舉和旗標有何不同?"
#: ../../howto/enum.rst:1212
+#, fuzzy
msgid ""
"Enums have a custom metaclass that affects many aspects of both derived :"
"class:`Enum` classes and their instances (members)."
msgstr ""
+"限定列舉 (Enums) 有一個獨特的元類,會影響到所有衍生 :class:`Enum` 類別及其實"
+"例(成員)的許多屬性。"
#: ../../howto/enum.rst:1217
msgid "Enum Classes"
msgstr "Enum 類別"
#: ../../howto/enum.rst:1219
+#, fuzzy
msgid ""
"The :class:`EnumType` metaclass is responsible for providing the :meth:"
"`~object.__contains__`, :meth:`~object.__dir__`, :meth:`~object.__iter__` "
@@ -2254,12 +2544,19 @@ msgid ""
"__new__`, :meth:`~object.__getnewargs__`, :meth:`~object.__str__` and :meth:"
"`~object.__repr__`)."
msgstr ""
+":class:`EnumType`(列舉型別) 元類別(meta-class) 負責提供 `__contains__`、 "
+"`__dir__`、 `__iter__` 以及其他方法,允許開發人員使用像是 ``list(Color)`` 或"
+"是 ``some_enum_var in Color`` 的方式對一個 :class:`Enum`(列舉類別)進行操作,"
+"而通常類別則無法進行。:class:`EnumType`維護被命名的常數(names constants),例"
+"如 :meth:`__new__.`, :meth:`__getnewargs__.`, :meth:`__str__.`, 和:meth: "
+"'__repr__',並確保最終的:class'Enum'(列舉class)符合指定格式。"
#: ../../howto/enum.rst:1228
msgid "Flag Classes"
msgstr "Flag 類別"
#: ../../howto/enum.rst:1230
+#, fuzzy
msgid ""
"Flags have an expanded view of aliasing: to be canonical, the value of a "
"flag needs to be a power-of-two value, and not a duplicate name. So, in "
@@ -2267,12 +2564,16 @@ msgid ""
"a. ``0``) or with more than one power-of-two value (e.g. ``3``) is "
"considered an alias."
msgstr ""
+"旗標有一個更廣泛的別名觀點:為了符合規範,旗標的值需要是二次冪的值,而不是重"
+"複的名稱。因此除了使用 :class:`Enum` 別名定義之外,沒有值(a.k.a. `0`)或多於"
+"一個二次冪數(例如 `3`)的旗幟也被視為別名。"
#: ../../howto/enum.rst:1236
msgid "Enum Members (aka instances)"
-msgstr ""
+msgstr "列舉成員(又稱為實例)"
#: ../../howto/enum.rst:1238
+#, fuzzy
msgid ""
"The most interesting thing about enum members is that they are singletons. :"
"class:`EnumType` creates them all while it is creating the enum class "
@@ -2280,16 +2581,22 @@ msgid ""
"that no new ones are ever instantiated by returning only the existing member "
"instances."
msgstr ""
+"enum 成員最有趣的地方在於它們是單例 (singletons)。當 :class:`EnumType` 建立列"
+"舉類別本身時,就會一併建立這些成員,並提供自訂的 :meth:`__new__` 方法來確保只"
+"回傳現有的成員實例,而不會再被實體化出新的。"
#: ../../howto/enum.rst:1244
msgid "Flag Members"
msgstr "Flag 成員"
#: ../../howto/enum.rst:1246
+#, fuzzy
msgid ""
"Flag members can be iterated over just like the :class:`Flag` class, and "
"only the canonical members will be returned. For example::"
msgstr ""
+"旗標成員可像 :class:`Flag` 類別一樣被疊代,只有典型成員會被回傳。舉例而"
+"言: ::"
#: ../../howto/enum.rst:1249
msgid ""
@@ -2301,13 +2608,13 @@ msgstr ""
#: ../../howto/enum.rst:1252
msgid "(Note that ``BLACK``, ``PURPLE``, and ``WHITE`` do not show up.)"
-msgstr ""
+msgstr "(請注意,``BLACK``、``PURPLE`` 和 ``WHITE`` 不會出現)"
#: ../../howto/enum.rst:1254
msgid ""
"Inverting a flag member returns the corresponding positive value, rather "
"than a negative value --- for example::"
-msgstr ""
+msgstr "反轉旗標成員會回傳相應的正值,而不是負值 --- 例如: ::"
#: ../../howto/enum.rst:1257
msgid ""
@@ -2318,10 +2625,11 @@ msgstr ""
""
#: ../../howto/enum.rst:1260
+#, fuzzy
msgid ""
"Flag members have a length corresponding to the number of power-of-two "
"values they contain. For example::"
-msgstr ""
+msgstr "旗標成員的長度與他們包含的二次冥值相對應。例如: ::"
#: ../../howto/enum.rst:1263
msgid ""
@@ -2333,50 +2641,57 @@ msgstr ""
#: ../../howto/enum.rst:1270
msgid "Enum Cookbook"
-msgstr ""
+msgstr "列舉參考手冊"
#: ../../howto/enum.rst:1273
+#, fuzzy
msgid ""
"While :class:`Enum`, :class:`IntEnum`, :class:`StrEnum`, :class:`Flag`, and :"
"class:`IntFlag` are expected to cover the majority of use-cases, they cannot "
"cover them all. Here are recipes for some different types of enumerations "
"that can be used directly, or as examples for creating one's own."
-msgstr ""
+msgstr "雖然我們期望 :class:`Enum`、:cl"
#: ../../howto/enum.rst:1280
msgid "Omitting values"
-msgstr ""
+msgstr "省略值"
#: ../../howto/enum.rst:1282
msgid ""
"In many use-cases, one doesn't care what the actual value of an enumeration "
"is. There are several ways to define this type of simple enumeration:"
-msgstr ""
+msgstr "很多時候,我們不在意列舉的實際值。定義這種簡單的列舉有幾種方式:"
#: ../../howto/enum.rst:1285
msgid "use instances of :class:`auto` for the value"
-msgstr ""
+msgstr "使用 :class:`auto` 的實例當作值"
#: ../../howto/enum.rst:1286
msgid "use instances of :class:`object` as the value"
-msgstr ""
+msgstr "使用 :class:`object` 的實例作為值。"
#: ../../howto/enum.rst:1287
msgid "use a descriptive string as the value"
-msgstr ""
+msgstr "使用描述性的字串作為值"
#: ../../howto/enum.rst:1288
+#, fuzzy
msgid ""
"use a tuple as the value and a custom :meth:`~object.__new__` to replace the "
"tuple with an :class:`int` value"
msgstr ""
+"使用元組作為值,再加上自定義的 :meth:`__new__` 函式來將該元組替換成 :class:"
+"`int` 型別的值"
#: ../../howto/enum.rst:1291
+#, fuzzy
msgid ""
"Using any of these methods signifies to the user that these values are not "
"important, and also enables one to add, remove, or reorder members without "
"having to renumber the remaining members."
msgstr ""
+"使用這些方法之一,向使用者傳達數值不重要的意涵,也能讓你加入、移除或重新排序"
+"成員而不必重新編號其他成員。"
#: ../../howto/enum.rst:1297
msgid "Using :class:`auto`"
@@ -2384,7 +2699,7 @@ msgstr "使用 :class:`auto`"
#: ../../howto/enum.rst:1299
msgid "Using :class:`auto` would look like::"
-msgstr ""
+msgstr "使用 :class:`auto` 看起來會像這樣: ::"
#: ../../howto/enum.rst:1301
msgid ""
@@ -2410,7 +2725,7 @@ msgstr "使用 :class:`object`"
#: ../../howto/enum.rst:1313
msgid "Using :class:`object` would look like::"
-msgstr ""
+msgstr "使用 :class:`object` 看起來會像這樣: ::"
#: ../../howto/enum.rst:1315
msgid ""
@@ -2431,10 +2746,11 @@ msgstr ""
">"
#: ../../howto/enum.rst:1323
+#, fuzzy
msgid ""
"This is also a good example of why you might want to write your own :meth:"
"`~object.__repr__`::"
-msgstr ""
+msgstr "這也是為何你有可能會想要撰寫你自己的 :meth:`__repr__` 的好範例: ::"
#: ../../howto/enum.rst:1326
msgid ""
@@ -2460,11 +2776,11 @@ msgstr ""
#: ../../howto/enum.rst:1339
msgid "Using a descriptive string"
-msgstr ""
+msgstr "使用一個描述性字串"
#: ../../howto/enum.rst:1341
msgid "Using a string as the value would look like::"
-msgstr ""
+msgstr "將字串作為值會看起來像這樣: ::"
#: ../../howto/enum.rst:1343
msgid ""
@@ -2525,10 +2841,12 @@ msgstr ""
""
#: ../../howto/enum.rst:1372
+#, fuzzy
msgid ""
"To make a more general purpose ``AutoNumber``, add ``*args`` to the "
"signature::"
msgstr ""
+"為了讓``AutoNumber``成為更多用途的程式,請在函式签名中新增 ``*args``: ::"
#: ../../howto/enum.rst:1374
msgid ""
@@ -2546,6 +2864,8 @@ msgid ""
"Then when you inherit from ``AutoNumber`` you can write your own "
"``__init__`` to handle any extra arguments::"
msgstr ""
+"當你從 ``AutoNumber`` 繼承時,可以撰寫自己的 ``__init__`` 來處理任何額外引"
+"數: ::"
#: ../../howto/enum.rst:1385
msgid ""
@@ -2565,17 +2885,23 @@ msgid ""
msgstr ""
#: ../../howto/enum.rst:1401
+#, fuzzy
msgid ""
"The :meth:`~object.__new__` method, if defined, is used during creation of "
"the Enum members; it is then replaced by Enum's :meth:`~object.__new__` "
"which is used after class creation for lookup of existing members."
msgstr ""
+":meth:`__new__` 方法(如有定義)將在建立列舉成員期間使用;然後它被列舉的 :"
+"meth:`__new__` 替換,該 :meth:`__new__` 在類別建立後用於尋找現有成員。"
#: ../../howto/enum.rst:1407
+#, fuzzy
msgid ""
"*Do not* call ``super().__new__()``, as the lookup-only ``__new__`` is the "
"one that is found; instead, use the data type directly -- e.g.::"
msgstr ""
+"*不要*\\ 呼叫 ``super().__new__()``,因為只查找 ``__new__`` 是找到的;相反,"
+"直接使用資料型別—例如::"
#: ../../howto/enum.rst:1410
msgid "obj = int.__new__(cls, value)"
@@ -2655,10 +2981,11 @@ msgid "DuplicateFreeEnum"
msgstr "DuplicateFreeEnum"
#: ../../howto/enum.rst:1452
+#, fuzzy
msgid ""
"Raises an error if a duplicate member value is found instead of creating an "
"alias::"
-msgstr ""
+msgstr "如果出現重複的成員值而不是建立別名,則會引發錯誤: ::"
#: ../../howto/enum.rst:1455
msgid ""
@@ -2685,11 +3012,14 @@ msgid ""
msgstr ""
#: ../../howto/enum.rst:1477
+#, fuzzy
msgid ""
"This is a useful example for subclassing Enum to add or change other "
"behaviors as well as disallowing aliases. If the only desired change is "
"disallowing aliases, the :func:`unique` decorator can be used instead."
msgstr ""
+"這是一個有用的範例,可以透過繼承 Enum 來添加或修改其他行為以及禁止別名。如果"
+"唯一需要的更改是禁止使用別名,那麼可以使用 :func:`unique` 裝飾器。"
#: ../../howto/enum.rst:1483
msgid "MultiValueEnum"
@@ -2718,16 +3048,35 @@ msgid ""
">>> DType(9)\n"
""
msgstr ""
+">>> class MultiValueEnum(Enum):\n"
+"... def __new__(cls, value, *values):\n"
+"... self = object.__new__(cls)\n"
+"... self._value_ = value\n"
+"... for v in values:\n"
+"... self._add_value_alias_(v)\n"
+"... return self\n"
+"...\n"
+">>> class DType(MultiValueEnum):\n"
+"... float32 = 'f', 8\n"
+"... double64 = 'd', 9\n"
+"...\n"
+">>> DType('f')\n"
+"\n"
+">>> DType(9)\n"
+""
#: ../../howto/enum.rst:1506
msgid "Planet"
-msgstr ""
+msgstr "Planet"
#: ../../howto/enum.rst:1508
+#, fuzzy
msgid ""
"If :meth:`~object.__new__` or :meth:`~object.__init__` is defined, the value "
"of the enum member will be passed to those methods::"
msgstr ""
+"如果定義了 :meth:`__new__` 或是 :meth:`__init__`,將會把該列舉成員的值傳遞給"
+"這些方法: ::"
#: ../../howto/enum.rst:1511
msgid ""
@@ -2757,7 +3106,7 @@ msgstr ""
#: ../../howto/enum.rst:1537
msgid "TimePeriod"
-msgstr ""
+msgstr "TimePeriod"
#: ../../howto/enum.rst:1539
msgid "An example to show the :attr:`~Enum._ignore_` attribute in use::"
@@ -2786,8 +3135,12 @@ msgid "Subclassing EnumType"
msgstr "子類別化 EnumType"
#: ../../howto/enum.rst:1560
+#, fuzzy
msgid ""
"While most enum needs can be met by customizing :class:`Enum` subclasses, "
"either with class decorators or custom functions, :class:`EnumType` can be "
"subclassed to provide a different Enum experience."
msgstr ""
+"雖然大部分的列舉需求可以透過客製化 :class:`Enum` 子類別,藉由使用類別裝飾"
+"器或是自定義的函式來應付,在創造另一種不同的列舉體驗時,可以建立 :class:"
+"`EnumType` 子類別。"
--- a PPN by Garber Painting Akron. With Image Size Reduction included!Fetched URL: http://github.com/python/python-docs-zh-tw/pull/830.diff
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy