@@ -251,16 +251,6 @@ Data Types
251
251
>>> list(reversed(Color))
252
252
[<Color.BLUE: 3>, <Color.GREEN: 2>, <Color.RED: 1>]
253
253
254
- .. method :: EnumType._add_alias_
255
-
256
- Adds a new name as an alias to an existing member. Raises a
257
- :exc: `NameError ` if the name is already assigned to a different member.
258
-
259
- .. method :: EnumType._add_value_alias_
260
-
261
- Adds a new value as an alias to an existing member. Raises a
262
- :exc: `ValueError ` if the value is already linked with a different member.
263
-
264
254
.. versionadded :: 3.11
265
255
266
256
Before 3.11 ``EnumType `` was called ``EnumMeta ``, which is still available as an alias.
@@ -470,6 +460,30 @@ Data Types
470
460
471
461
.. versionchanged :: 3.12 Added :ref:`enum-dataclass-support`
472
462
463
+ .. method :: Enum._add_alias_
464
+
465
+ Adds a new name as an alias to an existing member::
466
+
467
+ >>> Color._add_alias_(Color.RED, "ERROR")
468
+ >>> Color.ERROR
469
+ <Color.RED: 1>
470
+
471
+ Raises a :exc: `NameError ` if the name is already assigned to a different member.
472
+
473
+ .. versionadded :: 3.13
474
+
475
+ .. method :: Enum._add_value_alias_
476
+
477
+ Adds a new value as an alias to an existing member::
478
+
479
+ >>> Color._add_value_alias_(Color.RED, 42)
480
+ >>> Color(42)
481
+ <Color.RED: 1>
482
+
483
+ Raises a :exc: `ValueError ` if the value is already linked with a different member.
484
+
485
+ .. versionadded :: 3.13
486
+
473
487
474
488
.. class :: IntEnum
475
489
@@ -864,9 +878,9 @@ Once all the members are created it is no longer used.
864
878
Supported ``_sunder_ `` names
865
879
""""""""""""""""""""""""""""
866
880
867
- - :meth: `~EnumType ._add_alias_ ` -- adds a new name as an alias to an existing
881
+ - :meth: `~Enum ._add_alias_ ` -- adds a new name as an alias to an existing
868
882
member.
869
- - :meth: `~EnumType ._add_value_alias_ ` -- adds a new value as an alias to an
883
+ - :meth: `~Enum ._add_value_alias_ ` -- adds a new value as an alias to an
870
884
existing member.
871
885
- :attr: `~Enum._name_ ` -- name of the member
872
886
- :attr: `~Enum._value_ ` -- value of the member; can be set in ``__new__ ``
0 commit comments