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 BLACK = 0
WHITE = 1 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): behavior (blank cells indicate no behavioral change):
+--------+------------------------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+ +--------+------------------------+-----------------+------------+-----------------------+
| style | category | enum repr() | enum str() | enum format() | flag repr() | flag str() | flag format() | | style | category | enum repr() | enum str() | enum format() |
+--------+-------------+----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+ +--------+-------------+----------+-----------------+------------+-----------------------+
| normal | simple | 3.10 | | | | <Color.RED|GREEN: 3> | Color.RED|GREEN | Color.RED|GREEN | | normal | simple | 3.10 | | | |
| | +----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+ | | +----------+-----------------+------------+-----------------------+
| | | new | | | | <Color(3): RED|GREEN> | Color.RED|Color.GREEN | Color.RED|Color.GREEN | | | | new | | | |
| +-------------+----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+ | +-------------+----------+-----------------+------------+-----------------------+
| | user mixed | 3.10 | | | 1 | <Grey.WHITE: 1> | | 1 | | | user mixed | 3.10 | | | 1 |
| | +----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+ | | +----------+-----------------+------------+-----------------------+
| | | new | | | Grey.WHITE | <Grey(1): WHITE> | | Grey.WHITE | | | | new | | | Grey.WHITE |
| +-------------+----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+ | +-------------+----------+-----------------+------------+-----------------------+
| | int drop-in | 3.10 | | Hue.LIGHT | | <Color.RED|GREEN: 3> | Color.RED|GREEN | | | | int drop-in | 3.10 | | Hue.LIGHT | |
| | +----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+ | | +----------+-----------------+------------+-----------------------+
| | | new | | -1 | | <Color(3): RED|GREEN> | 3 | | | | | new | | -1 | |
+--------+-------------+----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+ +--------+-------------+----------+-----------------+------------+-----------------------+
| global | simple | 3.10 | <Hue.LIGHT: -1> | Hue.LIGHT | Hue.LIGHT | <Color.RED|GREEN: 3> | Color.RED|GREEN | Color.RED|GREEN | | global | simple | 3.10 | <Hue.LIGHT: -1> | Hue.LIGHT | Hue.LIGHT |
| | +----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+ | | +----------+-----------------+------------+-----------------------+
| | | new | tools.LIGHT | LIGHT | LIGHT | tools.RED|tools.GREEN | RED|GREEN | RED|GREEN | | | | new | tools.LIGHT | LIGHT | LIGHT |
| +-------------+----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+ | +-------------+----------+-----------------+------------+-----------------------+
| | user mixed | 3.10 | <Grey.WHITE: 1 | Grey.WHITE | Grey.WHITE | <Grey.WHITE: 1> | Grey.WHITE | 1 | | | user mixed | 3.10 | <Grey.WHITE: 1 | Grey.WHITE | Grey.WHITE |
| | +----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+ | | +----------+-----------------+------------+-----------------------+
| | | new | tools.WHITE | WHITE | WHITE | tools.WHITE | WHITE | WHITE | | | | new | tools.WHITE | WHITE | WHITE |
| +-------------+----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+ | +-------------+----------+-----------------+------------+-----------------------+
| | int drop-in | 3.10 | <Hue.LIGHT: -1> | Hue.LIGHT | | <Color.RED|GREEN: 3> | Color.RED|GREEN | | | | int drop-in | 3.10 | <Hue.LIGHT: -1> | Hue.LIGHT | |
| | +----------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+ | | +----------+-----------------+------------+-----------------------+
| | | new | tools.LIGHT | -1 | | tools.RED|tools.GREEN | 3 | | | | | 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 | |
+--------+-------------+----------+-----------------------+------------------------+-----------------------+
+--------+-------------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+ These two tables show the final result:
| 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 | | style | category | enum repr() | enum str() | enum format() |
| +-------------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+ +--------+-------------+-----------------+------------+-----------------------+
| | user mixed | <Grey.WHITE: 1> | Grey.WHITE | Grey.WHITE | <Grey(1): WHITE> | Grey.WHITE | Grey.WHITE | | normal | simple | <Hue.LIGHT: -1> | Hue.LIGHT | Hue.LIGHT |
| +-------------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+ | +-------------+-----------------+------------+-----------------------+
| | int drop-in | <Hue.LIGHT: -1> | -1 | -1 | <Color(3): RED|GREEN> | 3 | 3 | | | user mixed | <Grey.WHITE: 1> | Grey.WHITE | Grey.WHITE |
+--------+-------------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+ | +-------------+-----------------+------------+-----------------------+
| global | simple | tools.LIGHT | LIGHT | LIGHT | tools.RED|tools.GREEN | RED|GREEN | RED|GREEN | | | int drop-in | <Hue.LIGHT: -1> | -1 | -1 |
| +-------------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+ +--------+-------------+-----------------+------------+-----------------------+
| | user mixed | tools.WHITE | WHITE | WHITE | tools.WHITE | WHITE | WHITE | | global | simple | tools.LIGHT | LIGHT | LIGHT |
| +-------------+-----------------+------------+-----------------------+-----------------------+------------------------+-----------------------+ | +-------------+-----------------+------------+-----------------------+
| | int drop-in | tools.LIGHT | -1 | -1 | tools.RED|tools.GREEN | 3 | 3 | | | 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 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 global, while ``str()`` is affected by being global or by being a drop-in