8000 [3.12] gh-118820: Zero-valued flag enum has no name (GH-118848) (GH12… · python/cpython@6421db1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6421db1

Browse files
miss-islingtonnineteendopicnixz
authored
[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 ed5ae6c) Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
1 parent 34ace5b commit 6421db1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Doc/howto/enum.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,6 +1129,14 @@ the following are true:
11291129
>>> (Color.RED | Color.GREEN).name
11301130
'RED|GREEN'
11311131

1132+
>>> class Perm(IntFlag):
1133+
... R = 4
1134+
... W = 2
1135+
... X = 1
1136+
...
1137+
>>> (Perm.R & Perm.W).name is None # effectively Perm(0)
1138+
True
1139+
11321140
- multi-bit flags, aka aliases, can be returned from operations::
11331141

11341142
>>> Color.RED | Color.BLUE

0 commit comments

Comments
 (0)
0