]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-118820: Zero-valued flag enum has no name (GH-118848)
authorNice Zombies <nineteendo19d0@gmail.com>
Wed, 19 Jun 2024 20:09:53 +0000 (22:09 +0200)
committerGitHub <noreply@github.com>
Wed, 19 Jun 2024 20:09:53 +0000 (13:09 -0700)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Doc/howto/enum.rst

index 748ec5b24365d159d3f016cebe07b3bafa247f98..18e13fcf9f59bd925e077ca74b0295330af6af00 100644 (file)
@@ -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