Skip to content

Commit ed5ae6c

Browse files
nineteendopicnixz
andauthored
gh-118820: Zero-valued flag enum has no name (GH-118848)
Co-authored-by: Bénédikt Tran <[email protected]>
1 parent 753ef8d commit ed5ae6c

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

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

11571165
>>> Color.RED | Color.BLUE

0 commit comments

Comments
 (0)