[New-bugs-announce] [issue43957] [Enum] update __contains__ to return True for valid values

Ethan Furman report at bugs.python.org
Tue Apr 27 15:11:08 EDT 2021

New submission from Ethan Furman <ethan at stoneleaf.us>:

In 3.12 `__contains__` will check for both members and values:

    Color.RED in Color  --> True
    1 in Color          --> True
    'RED' in Color      --> False

Add DeprecationWarning for now.

assignee: ethan.furman
messages: 392122
nosy: ethan.furman
priority: normal
severity: normal
stage: needs patch
status: open
title: [Enum] update __contains__ to return True for valid values
type: behavior
versions: Python 3.10

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list