diff options
author | Ethan Furman <ethan@stoneleaf.us> | 2021-04-27 20:05:08 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-27 20:05:08 (GMT) |
commit | 6bd9288b805c765ec2433f66aa4d82e05767325f (patch) | |
tree | 5810c0de5a0086fec858ccf222cf1d42d459ba96 /Doc/library | |
parent | 9aea31deddf7458be3546f72185740f3cd06687f (diff) | |
download | cpython-6bd9288b805c765ec2433f66aa4d82e05767325f.zip cpython-6bd9288b805c765ec2433f66aa4d82e05767325f.tar.gz cpython-6bd9288b805c765ec2433f66aa4d82e05767325f.tar.bz2 |
bpo-43957: [Enum] Deprecate ``TypeError`` from containment checks. (GH-25670)
In 3.12 ``True`` or ``False`` will be returned for all containment checks,
with ``True`` being returned if the value is either a member of that enum
or one of its members' value.
Diffstat (limited to 'Doc/library')
-rw-r--r-- | Doc/library/enum.rst | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Doc/library/enum.rst b/Doc/library/enum.rst index 91c214e..b5f9c2f 100644 --- a/Doc/library/enum.rst +++ b/Doc/library/enum.rst @@ -140,6 +140,12 @@ Data Types >>> 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. + .. method:: EnumType.__dir__(cls) Returns ``['__class__', '__doc__', '__members__', '__module__']`` and the |