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

Update enum.EnumType.__contains__ for Python 3.12 #111182

Open
InSyncWithFoo opened this issue Oct 22, 2023 · 0 comments · May be fixed by #111184
Open

Update enum.EnumType.__contains__ for Python 3.12 #111182

InSyncWithFoo opened this issue Oct 22, 2023 · 0 comments · May be fixed by #111184
Labels
docs Documentation in the Doc dir

Comments

@InSyncWithFoo
Copy link
Contributor

InSyncWithFoo commented Oct 22, 2023

Documentation

The doc currently says:

class enum.EnumType
[...]

__contains__(cls, member)
Returns True if member belongs to the cls:

>>> some_var = Color.RED
>>> some_var in Color
True

Note: In Python 3.12 it will be possible to check for member values and not just members; until then, a TypeError will be raised if a non-Enum-member is used in a containment check.

Python 3.12 has already been released, so this note block should be replaced with a Changed in version 3.12 note:

Changed in version 3.12: Before Python 3.12, a TypeError is raised if a non-Enum-member is used in a containment check.

Linked PRs

@InSyncWithFoo InSyncWithFoo added the docs Documentation in the Doc dir label Oct 22, 2023
InSyncWithFoo added a commit to InSyncWithFoo/cpython that referenced this issue Oct 22, 2023
InSyncWithFoo added a commit to InSyncWithFoo/cpython that referenced this issue Oct 22, 2023
InSyncWithFoo added a commit to InSyncWithFoo/cpython that referenced this issue Oct 22, 2023
@InSyncWithFoo InSyncWithFoo linked a pull request Oct 22, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir
Projects
None yet
1 participant