Skip to content

Update enum.EnumType.__contains__ for Python 3.12 #111182

@InSyncWithFoo

Description

@InSyncWithFoo

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions