Skip to content

Commit e415d25

Browse files
miss-islingtonnineteendopicnixz
authored
[3.13] gh-118820: Zero-valued flag enum has no name (GH-118848) (GH-120759)
gh-118820: Zero-valued flag enum has no name (GH-118848) (cherry picked from commit ed5ae6c) Co-authored-by: Nice Zombies <[email protected]> Co-authored-by: Bénédikt Tran <[email protected]>
1 parent 355d928 commit e415d25

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
@@ -1150,6 +1150,14 @@ the following are true:
11501150
>>> (Color.RED | Color.GREEN).name
11511151
'RED|GREEN'
11521152

1153+
>>> class Perm(IntFlag):
1154+
... R = 4
1155+
... W = 2
1156+
... X = 1
1157+
...
1158+
>>> (Perm.R & Perm.W).name is None # effectively Perm(0)
1159+
True
1160+
11531161
- multi-bit flags, aka aliases, can be returned from operations::
11541162

11551163
>>> Color.RED | Color.BLUE

0 commit comments

Comments
 (0)