PEP 663: split tables so viewing is easier

This commit is contained in:
Ethan Furman 2021-10-22 05:04:44 -07:00
parent 7a9fa54f8f
commit 0c0a7e9d65
1 changed files with 88 additions and 44 deletions

View File

@ -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: 3> | Color.RED|GREEN | Color.RED|GREEN |
| | +----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
| | | new | | | | <Color(3): RED|GREEN> | Color.RED|Color.GREEN | Color.RED|Color.GREEN |
| +-------------+----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
| | user mixed | 3.10 | | | 1 | <Grey.WHITE: 1> | | 1 |
| | +----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
| | | new | | | Grey.WHITE | <Grey(1): WHITE> | | Grey.WHITE |
| +-------------+----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
| | int drop-in | 3.10 | | Hue.LIGHT | | <Color.RED|GREEN: 3> | Color.RED|GREEN | |
| | +----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
| | | new | | -1 | | <Color(3): RED|GREEN> | 3 | |
+--------+-------------+----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
| global | simple | 3.10 | <Hue.LIGHT: -1> | Hue.LIGHT | Hue.LIGHT | <Color.RED|GREEN: 3> | 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 | Grey.WHITE | Grey.WHITE | <Grey.WHITE: 1> | Grey.WHITE | 1 |
| | +----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
| | | new | tools.WHITE | WHITE | WHITE | tools.WHITE | WHITE | WHITE |
| +-------------+----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
| | int drop-in | 3.10 | <Hue.LIGHT: -1> | Hue.LIGHT | | <Color.RED|GREEN: 3> | 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: -1> | Hue.LIGHT | Hue.LIGHT |
| | +----------+-----------------+------------+-----------------------+
| | | new | tools.LIGHT | LIGHT | LIGHT |
| +-------------+----------+-----------------+------------+-----------------------+
| | user mixed | 3.10 | <Grey.WHITE: 1 | Grey.WHITE | Grey.WHITE |
| | +----------+-----------------+------------+-----------------------+
| | | new | tools.WHITE | WHITE | WHITE |
| +-------------+----------+-----------------+------------+-----------------------+
| | int drop-in | 3.10 | <Hue.LIGHT: -1> | 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: 3> | Color.RED|GREEN | Color.RED|GREEN |
| | +----------+-----------------------+------------------------+-----------------------+
| | | new | <Color(3): RED|GREEN> | Color.RED|Color.GREEN | Color.RED|Color.GREEN |
| +-------------+----------+-----------------------+------------------------+-----------------------+
| | user mixed | 3.10 | <Grey.WHITE: 1> | | 1 |
| | +----------+-----------------------+------------------------+-----------------------+
| | | new | <Grey(1): WHITE> | | Grey.WHITE |
| +-------------+----------+-----------------------+------------------------+-----------------------+
| | int drop-in | 3.10 | <Color.RED|GREEN: 3> | Color.RED|GREEN | |
| | +----------+-----------------------+------------------------+-----------------------+
| | | new | <Color(3): RED|GREEN> | 3 | |
+--------+-------------+----------+-----------------------+------------------------+-----------------------+
| global | simple | 3.10 | <Color.RED|GREEN: 3> | Color.RED|GREEN | Color.RED|GREEN |
| | +----------+-----------------------+------------------------+-----------------------+
| | | new | tools.RED|tools.GREEN | RED|GREEN | RED|GREEN |
| +-------------+----------+-----------------------+------------------------+-----------------------+
| | user mixed | 3.10 | <Grey.WHITE: 1> | Grey.WHITE | 1 |
| | +----------+-----------------------+------------------------+-----------------------+
| | | new | tools.WHITE | WHITE | WHITE |
| +-------------+----------+-----------------------+------------------------+-----------------------+
| | int drop-in | 3.10 | <Color.RED|GREEN: 3> | 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: -1> | Hue.LIGHT | Hue.LIGHT | <Color(3): RED|GREEN> | Color.RED|Color.GREEN | Color.RED|Color.GREEN |
| +-------------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
| | user mixed | <Grey.WHITE: 1> | Grey.WHITE | Grey.WHITE | <Grey(1): WHITE> | Grey.WHITE | Grey.WHITE |
| +-------------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+
| | int drop-in | <Hue.LIGHT: -1> | -1 | -1 | <Color(3): RED|GREEN> | 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: -1> | Hue.LIGHT | Hue.LIGHT |
| +-------------+-----------------+------------+-----------------------+
| | user mixed | <Grey.WHITE: 1> | Grey.WHITE | Grey.WHITE |
| +-------------+-----------------+------------+-----------------------+
| | int drop-in | <Hue.LIGHT: -1> | -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(3): RED|GREEN> | Color.RED|Color.GREEN | Color.RED|Color.GREEN |
| +-------------+-----------------------+------------------------+-----------------------+
| | user mixed | <Grey(1): WHITE> | Grey.WHITE | Grey.WHITE |
| +-------------+-----------------------+------------------------+-----------------------+
| | int drop-in | <Color(3): RED|GREEN> | 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