@@ -36,8 +36,10 @@ inherits from :class:`Enum` itself.
36
36
37
37
.. note :: Case of Enum Members
38
38
39
- Because Enums are used to represent constants we recommend using
40
- UPPER_CASE names for members, and will be using that style in our examples.
39
+ Because Enums are used to represent constants, and to help avoid issues
40
+ with name clashes between mixin-class methods/attributes and enum names,
41
+ we strongly recommend using UPPER_CASE names for members, and will be using
42
+ that style in our examples.
41
43
42
44
Depending on the nature of the enum a member's value may or may not be
43
45
important, but either way that value can be used to get the corresponding
@@ -490,6 +492,10 @@ the :meth:`~Enum.__repr__` omits the inherited class' name. For example::
490
492
Use the :func: `!dataclass ` argument ``repr=False ``
491
493
to use the standard :func: `repr `.
492
494
495
+ .. versionchanged :: 3.12
496
+ Only the dataclass fields are shown in the value area, not the dataclass'
497
+ name.
498
+
493
499
494
500
Pickling
495
501
--------
@@ -992,7 +998,9 @@ but remain normal attributes.
992
998
Enum members are instances of their enum class, and are normally accessed as
993
999
``EnumClass.member ``. In certain situations, such as writing custom enum
994
1000
behavior, being able to access one member directly from another is useful,
995
- and is supported.
1001
+ and is supported; however, in order to avoid name clashes between member names
1002
+ and attributes/methods from mixed-in classes, upper-case names are strongly
1003
+ recommended.
996
1004
997
1005
.. versionchanged :: 3.5
998
1006
0 commit comments