mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
gh-103365: [Enum] STRICT boundary corrections (GH-103494)
STRICT boundary: - fix bitwise operations - make default for Flag
This commit is contained in:
parent
efb8a2553c
commit
2194071540
4 changed files with 82 additions and 38 deletions
|
@ -696,7 +696,8 @@ Data Types
|
|||
|
||||
.. attribute:: STRICT
|
||||
|
||||
Out-of-range values cause a :exc:`ValueError` to be raised::
|
||||
Out-of-range values cause a :exc:`ValueError` to be raised. This is the
|
||||
default for :class:`Flag`::
|
||||
|
||||
>>> from enum import Flag, STRICT, auto
|
||||
>>> class StrictFlag(Flag, boundary=STRICT):
|
||||
|
@ -714,7 +715,7 @@ Data Types
|
|||
.. attribute:: CONFORM
|
||||
|
||||
Out-of-range values have invalid values removed, leaving a valid *Flag*
|
||||
value. This is the default for :class:`Flag`::
|
||||
value::
|
||||
|
||||
>>> from enum import Flag, CONFORM, auto
|
||||
>>> class ConformFlag(Flag, boundary=CONFORM):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue