Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-118820: Zero-valued flag enum has no name #118848

Merged
merged 7 commits into from
Jun 19, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion Doc/howto/enum.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1116,7 +1116,7 @@ are comprised of a single bit::
``Flag`` and ``IntFlag`` minutia
""""""""""""""""""""""""""""""""

Using the following snippet for our examples::
Using the following snippets for our examples::

>>> class Color(IntFlag):
... BLACK = 0
Expand All @@ -1126,6 +1126,11 @@ Using the following snippet for our examples::
... PURPLE = RED | BLUE
... WHITE = RED | GREEN | BLUE
...
>>> class Perm(IntFlag):
... R = 4
... W = 2
... X = 1
...

the following are true:

Expand All @@ -1149,6 +1154,8 @@ the following are true:

>>> (Color.RED | Color.GREEN).name
'RED|GREEN'
>>> (Perm.R & Perm.W).name is None
nineteendo marked this conversation as resolved.
Show resolved Hide resolved
True

- multi-bit flags, aka aliases, can be returned from operations::

Expand Down
Loading