@@ -967,69 +967,10 @@ want one of them to be the value::
967
967
Finer Points
968
968
^^^^^^^^^^^^
969
969
970
- Supported ``__dunder__ `` names
971
- """"""""""""""""""""""""""""""
970
+ Supported ``__dunder__ `` and `` _sunder_ `` names
971
+ """""""""""""""""""""""""""""""""""""""""""""""
972
972
973
- :attr: `~enum.EnumType.__members__ ` is a read-only ordered mapping of ``member_name ``:``member ``
974
- items. It is only available on the class.
975
-
976
- :meth: `~object.__new__ `, if specified, must create and return the enum members; it is
977
- also a very good idea to set the member's :attr: `~Enum._value_ ` appropriately. Once
978
- all the members are created it is no longer used.
979
-
980
-
981
- Supported ``_sunder_ `` names
982
- """"""""""""""""""""""""""""
983
-
984
- - :attr: `~Enum._name_ ` -- name of the member
985
- - :attr: `~Enum._value_ ` -- value of the member; can be set in ``__new__ ``
986
- - :meth: `~Enum._missing_ ` -- a lookup function used when a value is not found;
987
- may be overridden
988
- - :attr: `~Enum._ignore_ ` -- a list of names, either as a :class: `list ` or a
989
- :class: `str `, that will not be transformed into members, and will be removed
990
- from the final class
991
- - :meth: `~Enum._generate_next_value_ ` -- used to get an appropriate value for
992
- an enum member; may be overridden
993
- - :meth: `~Enum._add_alias_ ` -- adds a new name as an alias to an existing
994
- member.
995
- - :meth: `~Enum._add_value_alias_ ` -- adds a new value as an alias to an
996
- existing member. See `MultiValueEnum `_ for an example.
997
-
998
- .. note ::
999
-
1000
- For standard :class: `Enum ` classes the next value chosen is the highest
1001
- value seen incremented by one.
1002
-
1003
- For :class: `Flag ` classes the next value chosen will be the next highest
1004
- power-of-two.
1005
-
1006
- .. versionchanged :: 3.13
1007
- Prior versions would use the last seen value instead of the highest value.
1008
-
1009
- .. versionadded :: 3.6 ``_missing_``, ``_order_``, ``_generate_next_value_``
1010
- .. versionadded :: 3.7 ``_ignore_``
1011
- .. versionadded :: 3.13 ``_add_alias_``, ``_add_value_alias_``
1012
-
1013
- To help keep Python 2 / Python 3 code in sync an :attr: `~Enum._order_ ` attribute can
1014
- be provided. It will be checked against the actual order of the enumeration
1015
- and raise an error if the two do not match::
1016
-
1017
- >>> class Color(Enum):
1018
- ... _order_ = 'RED GREEN BLUE'
1019
- ... RED = 1
1020
- ... BLUE = 3
1021
- ... GREEN = 2
1022
- ...
1023
- Traceback (most recent call last):
1024
- ...
1025
- TypeError: member order does not match _order_:
1026
- ['RED', 'BLUE', 'GREEN']
1027
- ['RED', 'GREEN', 'BLUE']
1028
-
1029
- .. note ::
1030
-
1031
- In Python 2 code the :attr: `~Enum._order_ ` attribute is necessary as definition
1032
- order is lost before it can be recorded.
973
+ The supported ``__dunder__ `` and ``_sunder_ `` names can be found in the :ref: `Enum API documentation <enum-dunder-sunder >`.
1033
974
1034
975
1035
976
_Private__names
@@ -1478,6 +1419,7 @@ alias::
1478
1419
behaviors as well as disallowing aliases. If the only desired change is
1479
1420
disallowing aliases, the :func: `unique ` decorator can be used instead.
1480
1421
1422
+ .. _multi-value-enum :
1481
1423
1482
1424
MultiValueEnum
1483
1425
^^^^^^^^^^^^^^^^^
0 commit comments