]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] gh-118820: Zero-valued flag enum has no name (GH-118848) (GH120758)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 19 Jun 2024 22:11:58 +0000 (00:11 +0200)
committerGitHub <noreply@github.com>
Wed, 19 Jun 2024 22:11:58 +0000 (15:11 -0700)
gh-118820: Zero-valued flag enum has no name (GH-118848)
(cherry picked from commit ed5ae6c4d76feaff06c2104c8ff864553b000253)

Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Doc/howto/enum.rst

index ffdafb749c73a922ab819ade1b312f5892ecaf46..04a1b3e41b7c06c18c71218795589aa3f64f008e 100644 (file)
@@ -1129,6 +1129,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