diff options
author | Owain Davies <116417456+OTheDev@users.noreply.github.com> | 2023-02-17 21:36:47 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-17 21:36:47 (GMT) |
commit | 7f1c72175600b21c1c840e8988cc6e6b4b244582 (patch) | |
tree | 2c01ac65ca7eb9e5601b83552e8d16c7df9654f6 /Doc/library/enum.rst | |
parent | 77d95c83733722ada35eb1ef89ae5b84a51ddd32 (diff) | |
download | cpython-7f1c72175600b21c1c840e8988cc6e6b4b244582.zip cpython-7f1c72175600b21c1c840e8988cc6e6b4b244582.tar.gz cpython-7f1c72175600b21c1c840e8988cc6e6b4b244582.tar.bz2 |
gh-101739: [Enum] update docs - default boundary for Flag is CONFORM (GH-101746)
Diffstat (limited to 'Doc/library/enum.rst')
-rw-r--r-- | Doc/library/enum.rst | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/Doc/library/enum.rst b/Doc/library/enum.rst index 13591a1..24b6dbf 100644 --- a/Doc/library/enum.rst +++ b/Doc/library/enum.rst @@ -696,10 +696,9 @@ Data Types .. attribute:: STRICT - Out-of-range values cause a :exc:`ValueError` to be raised. This is the - default for :class:`Flag`:: + Out-of-range values cause a :exc:`ValueError` to be raised:: - >>> from enum import Flag, STRICT + >>> from enum import Flag, STRICT, auto >>> class StrictFlag(Flag, boundary=STRICT): ... RED = auto() ... GREEN = auto() @@ -715,9 +714,9 @@ Data Types .. attribute:: CONFORM Out-of-range values have invalid values removed, leaving a valid *Flag* - value:: + value. This is the default for :class:`Flag`:: - >>> from enum import Flag, CONFORM + >>> from enum import Flag, CONFORM, auto >>> class ConformFlag(Flag, boundary=CONFORM): ... RED = auto() ... GREEN = auto() @@ -731,7 +730,7 @@ Data Types Out-of-range values lose their *Flag* membership and revert to :class:`int`. This is the default for :class:`IntFlag`:: - >>> from enum import Flag, EJECT + >>> from enum import Flag, EJECT, auto >>> class EjectFlag(Flag, boundary=EJECT): ... RED = auto() ... GREEN = auto() @@ -742,10 +741,10 @@ Data Types .. attribute:: KEEP - Out-of-range values are kept, and the *Flag* membership is kept. This is - used for some stdlib flags: + Out-of-range values are kept, and the *Flag* membership is kept. This is + used for some stdlib flags:: - >>> from enum import Flag, KEEP + >>> from enum import Flag, KEEP, auto >>> class KeepFlag(Flag, boundary=KEEP): ... RED = auto() ... GREEN = auto() |