mirror of
https://github.com/python/cpython
synced 2024-10-06 17:44:58 +00:00
[3.12] gh-118820: Zero-valued flag enum has no name (GH-118848) (GH120758)
gh-118820: Zero-valued flag enum has no name (GH-118848)
(cherry picked from commit ed5ae6c4d7
)
Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
This commit is contained in:
parent
34ace5ba4c
commit
6421db1d4d
|
@ -1129,6 +1129,14 @@ the following are true:
|
|||
>>> (Color.RED | Color.GREEN).name
|
||||
'RED|GREEN'
|
||||
|
||||
>>> class Perm(IntFlag):
|
||||
... R = 4
|
||||
... W = 2
|
||||
... X = 1
|
||||
...
|
||||
>>> (Perm.R & Perm.W).name is None # effectively Perm(0)
|
||||
True
|
||||
|
||||
- multi-bit flags, aka aliases, can be returned from operations::
|
||||
|
||||
>>> Color.RED | Color.BLUE
|
||||
|
|
Loading…
Reference in a new issue