summaryrefslogtreecommitdiffstats
path: root/Doc/howto/enum.rst
diff options
context:
space:
mode:
authorNice Zombies <nineteendo19d0@gmail.com>2024-06-19 20:09:53 (GMT)
committerGitHub <noreply@github.com>2024-06-19 20:09:53 (GMT)
commited5ae6c4d76feaff06c2104c8ff864553b000253 (patch)
treef5afe21b6cfca9811c221a9dfbb4e87851479666 /Doc/howto/enum.rst
parent753ef8db97ccb755d3c6fe089e883fe7ed5eb0d8 (diff)
downloadcpython-ed5ae6c4d76feaff06c2104c8ff864553b000253.zip
cpython-ed5ae6c4d76feaff06c2104c8ff864553b000253.tar.gz
cpython-ed5ae6c4d76feaff06c2104c8ff864553b000253.tar.bz2
gh-118820: Zero-valued flag enum has no name (GH-118848)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Diffstat (limited to 'Doc/howto/enum.rst')
-rw-r--r--Doc/howto/enum.rst8
1 files changed, 8 insertions, 0 deletions
diff --git a/Doc/howto/enum.rst b/Doc/howto/enum.rst
index 748ec5b..18e13fc 100644
--- a/Doc/howto/enum.rst
+++ b/Doc/howto/enum.rst
@@ -1152,6 +1152,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