@@ -9,7 +9,7 @@ Type: Informational
99Content-Type: text/x-rst
1010Created: 23-Feb-2013
1111Python-Version: 3.11
12- Post-History:
12+ Post-History: 20-Jul-2021
1313Resolution:
1414
1515
@@ -51,16 +51,17 @@ should be true (and the same for ``format()``).
5151
5252IntEnum, IntFlag, and StrEnum should be as close to a drop-in replacement of
5353existing integer and string constants as is possible. Towards that goal, the
54- str() output of each should be its inherent value; i.e.::
54+ str() output of each should be its inherent value; e.g. if ``Color`` is an
55+ ``IntEnum``::
5556
5657 >>> Color.RED
5758 <Color.RED: 1>
5859 >>> str(Color.RED)
59- 1
60+ '1'
6061 >>> format(Color.RED)
6162 '1'
6263
63- Note that format() already produces the correct output, only str() needs
64+ Note that format() already produces the correct output in 3.10 , only str() needs
6465updating.
6566
6667As much as possible, the ``str()`, ``repr()``, and ``format()`` of enum members
@@ -112,32 +113,32 @@ behavior, while the last shows the final result:
112113+-------------+----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
113114| type | enum repr() | enum str() | enum format() | flag repr() | flag str() | flag format() |
114115+-------------+----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
115- | standard | 3.9 | | | | <Color.RED|GREEN: 3> | Color.RED|GREEN | Color.RED|GREEN |
116+ | standard | 3.10 | | | | <Color.RED|GREEN: 3> | Color.RED|GREEN | Color.RED|GREEN |
116117| +----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
117118| | new | | | | <Color(3): RED|GREEN> | Color.RED|Color.GREEN | Color.RED|Color.GREEN |
118119+-------------+----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
119120+-------------+----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
120- | user mixed | 3.9 | | | 1 | <Grey.WHITE: 1> | | 1 |
121+ | user mixed | 3.10 | | | 1 | <Grey.WHITE: 1> | | 1 |
121122| +----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
122123| | new | | | Grey.WHITE | <Grey(1): WHITE> | | Grey.WHITE |
123124+-------------+----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
124125+-------------+----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
125- | int drop-in | 3.9 | | Hue.LIGHT | | <Color.RED|GREEN: 3> | Color.RED|GREEN | |
126+ | int drop-in | 3.10 | | Hue.LIGHT | | <Color.RED|GREEN: 3> | Color.RED|GREEN | |
126127| +----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
127128| | new | | -1 | | <Color(3): RED|GREEN> | 3 | |
128129+-------------+----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
129130+-------------+----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
130- | global | 3.9 | <Hue.LIGHT: -1> | Hue.LIGHT | Hue.LIGHT | <Color.RED|GREEN: 3> | Color.RED|GREEN | Color.RED|GREEN |
131+ | global | 3.10 | <Hue.LIGHT: -1> | Hue.LIGHT | Hue.LIGHT | <Color.RED|GREEN: 3> | Color.RED|GREEN | Color.RED|GREEN |
131132| +----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
132133| | new | tools.LIGHT | LIGHT | LIGHT | tools.RED|tools.GREEN | RED|GREEN | RED|GREEN |
133134+-------------+----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
134135+-------------+----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
135- | user mixed | 3.9 | <Grey.WHITE: 1 | Grey.WHITE | Grey.WHITE | <Grey.WHITE: 1> | Grey.WHITE | 1 |
136+ | user mixed | 3.10 | <Grey.WHITE: 1 | Grey.WHITE | Grey.WHITE | <Grey.WHITE: 1> | Grey.WHITE | 1 |
136137| +----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
137138| | new | tools.WHITE | WHITE | WHITE | tools.WHITE | WHITE | WHITE |
138139+-------------+----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
139140+-------------+----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
140- | int drop-in | 3.9 | <Hue.LIGHT: -1> | Hue.LIGHT | | <Color.RED|GREEN: 3> | Color.RED|GREEN | |
141+ | int drop-in | 3.10 | <Hue.LIGHT: -1> | Hue.LIGHT | | <Color.RED|GREEN: 3> | Color.RED|GREEN | |
141142| +----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
142143| | new | tools.LIGHT | -1 | | tools.RED|tools.GREEN | 3 | |
143144+-------------+----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
0 commit comments