diff --git a/pep-0663.txt b/pep-0663.txt index 18b8c9a14..23597edc2 100644 --- a/pep-0663.txt +++ b/pep-0663.txt @@ -114,54 +114,98 @@ Some sample enums:: BLACK = 0 WHITE = 1 -Using the above enumerations, the following table shows the old and new +Using the above enumerations, the following two tables show the old and new behavior (blank cells indicate no behavioral change): -+--------+------------------------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+ -| style | category | enum repr() | enum str() | enum format() | flag repr() | flag str() | flag format() | -+--------+-------------+----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+ -| normal | simple | 3.10 | | | | | Color.RED|GREEN | Color.RED|GREEN | -| | +----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+ -| | | new | | | | | Color.RED|Color.GREEN | Color.RED|Color.GREEN | -| +-------------+----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+ -| | user mixed | 3.10 | | | 1 | | | 1 | -| | +----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+ -| | | new | | | Grey.WHITE | | | Grey.WHITE | -| +-------------+----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+ -| | int drop-in | 3.10 | | Hue.LIGHT | | | Color.RED|GREEN | | -| | +----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+ -| | | new | | -1 | | | 3 | | -+--------+-------------+----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+ -| global | simple | 3.10 | | Hue.LIGHT | Hue.LIGHT | | Color.RED|GREEN | Color.RED|GREEN | -| | +----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+ -| | | new | tools.LIGHT | LIGHT | LIGHT | tools.RED|tools.GREEN | RED|GREEN | RED|GREEN | -| +-------------+----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+ -| | user mixed | 3.10 | | Grey.WHITE | 1 | -| | +----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+ -| | | new | tools.WHITE | WHITE | WHITE | tools.WHITE | WHITE | WHITE | -| +-------------+----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+ -| | int drop-in | 3.10 | | Hue.LIGHT | | | Color.RED|GREEN | | -| | +----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+ -| | | new | tools.LIGHT | -1 | | tools.RED|tools.GREEN | 3 | | -+--------+-------------+----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+ ++--------+------------------------+-----------------+------------+-----------------------+ +| style | category | enum repr() | enum str() | enum format() | ++--------+-------------+----------+-----------------+------------+-----------------------+ +| normal | simple | 3.10 | | | | +| | +----------+-----------------+------------+-----------------------+ +| | | new | | | | +| +-------------+----------+-----------------+------------+-----------------------+ +| | user mixed | 3.10 | | | 1 | +| | +----------+-----------------+------------+-----------------------+ +| | | new | | | Grey.WHITE | +| +-------------+----------+-----------------+------------+-----------------------+ +| | int drop-in | 3.10 | | Hue.LIGHT | | +| | +----------+-----------------+------------+-----------------------+ +| | | new | | -1 | | ++--------+-------------+----------+-----------------+------------+-----------------------+ +| global | simple | 3.10 | | Hue.LIGHT | Hue.LIGHT | +| | +----------+-----------------+------------+-----------------------+ +| | | new | tools.LIGHT | LIGHT | LIGHT | +| +-------------+----------+-----------------+------------+-----------------------+ +| | user mixed | 3.10 | | Hue.LIGHT | | +| | +----------+-----------------+------------+-----------------------+ +| | | new | tools.LIGHT | -1 | | ++--------+-------------+----------+-----------------+------------+-----------------------+ -This table shows the final result: ++--------+------------------------+-----------------------+------------------------+-----------------------+ +| style | category | flag repr() | flag str() | flag format() | ++--------+-------------+----------+-----------------------+------------------------+-----------------------+ +| normal | simple | 3.10 | | Color.RED|GREEN | Color.RED|GREEN | +| | +----------+-----------------------+------------------------+-----------------------+ +| | | new | | Color.RED|Color.GREEN | Color.RED|Color.GREEN | +| +-------------+----------+-----------------------+------------------------+-----------------------+ +| | user mixed | 3.10 | | | 1 | +| | +----------+-----------------------+------------------------+-----------------------+ +| | | new | | | Grey.WHITE | +| +-------------+----------+-----------------------+------------------------+-----------------------+ +| | int drop-in | 3.10 | | Color.RED|GREEN | | +| | +----------+-----------------------+------------------------+-----------------------+ +| | | new | | 3 | | ++--------+-------------+----------+-----------------------+------------------------+-----------------------+ +| global | simple | 3.10 | | Color.RED|GREEN | Color.RED|GREEN | +| | +----------+-----------------------+------------------------+-----------------------+ +| | | new | tools.RED|tools.GREEN | RED|GREEN | RED|GREEN | +| +-------------+----------+-----------------------+------------------------+-----------------------+ +| | user mixed | 3.10 | | Grey.WHITE | 1 | +| | +----------+-----------------------+------------------------+-----------------------+ +| | | new | tools.WHITE | WHITE | WHITE | +| +-------------+----------+-----------------------+------------------------+-----------------------+ +| | int drop-in | 3.10 | | Color.RED|GREEN | | +| | +----------+-----------------------+------------------------+-----------------------+ +| | | new | tools.RED|tools.GREEN | 3 | | ++--------+-------------+----------+-----------------------+------------------------+-----------------------+ -+--------+-------------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+ -| style | category | enum repr() | enum str() | enum format() | flag repr() | flag str() | flag format() | -+--------+-------------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+ -| normal | simple | | Hue.LIGHT | Hue.LIGHT | | Color.RED|Color.GREEN | Color.RED|Color.GREEN | -| +-------------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+ -| | user mixed | | Grey.WHITE | Grey.WHITE | | Grey.WHITE | Grey.WHITE | -| +-------------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+ -| | int drop-in | | -1 | -1 | | 3 | 3 | -+--------+-------------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+ -| global | simple | tools.LIGHT | LIGHT | LIGHT | tools.RED|tools.GREEN | RED|GREEN | RED|GREEN | -| +-------------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+ -| | user mixed | tools.WHITE | WHITE | WHITE | tools.WHITE | WHITE | WHITE | -| +-------------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+ -| | int drop-in | tools.LIGHT | -1 | -1 | tools.RED|tools.GREEN | 3 | 3 | -+--------+-------------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+ +These two tables show the final result: + ++--------+-------------+-----------------+------------+-----------------------+ +| style | category | enum repr() | enum str() | enum format() | ++--------+-------------+-----------------+------------+-----------------------+ +| normal | simple | | Hue.LIGHT | Hue.LIGHT | +| +-------------+-----------------+------------+-----------------------+ +| | user mixed | | Grey.WHITE | Grey.WHITE | +| +-------------+-----------------+------------+-----------------------+ +| | int drop-in | | -1 | -1 | ++--------+-------------+-----------------+------------+-----------------------+ +| global | simple | tools.LIGHT | LIGHT | LIGHT | +| +-------------+-----------------+------------+-----------------------+ +| | user mixed | tools.WHITE | WHITE | WHITE | +| +-------------+-----------------+------------+-----------------------+ +| | int drop-in | tools.LIGHT | -1 | -1 | ++--------+-------------+-----------------+------------+-----------------------+ + ++--------+-------------+-----------------------+------------------------+-----------------------+ +| style | category | flag repr() | flag str() | flag format() | ++--------+-------------+-----------------------+------------------------+-----------------------+ +| normal | simple | | Color.RED|Color.GREEN | Color.RED|Color.GREEN | +| +-------------+-----------------------+------------------------+-----------------------+ +| | user mixed | | Grey.WHITE | Grey.WHITE | +| +-------------+-----------------------+------------------------+-----------------------+ +| | int drop-in | | 3 | 3 | ++--------+-------------+-----------------------+------------------------+-----------------------+ +| global | simple | tools.RED|tools.GREEN | RED|GREEN | RED|GREEN | +| +-------------+-----------------------+------------------------+-----------------------+ +| | user mixed | tools.WHITE | WHITE | WHITE | +| +-------------+-----------------------+------------------------+-----------------------+ +| | int drop-in | tools.RED|tools.GREEN | 3 | 3 | ++--------+-------------+-----------------------+------------------------+-----------------------+ As can be seen, ``repr()`` is primarily affected by whether the members are global, while ``str()`` is affected by being global or by being a drop-in