You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Python 3.5, due to a performance enhancement, it became possible to access one member from another:
class Color(Enum):
RED = 1
GREEN = 2
BLUE = 3
>>> Color.RED.GREEN
Color.GREEN
This behavior has always been discouraged (from the docs):
Enum members are instances of their Enum class, and are
normally accessed as EnumClass.member. Under certain circumstances they
can also be accessed as EnumClass.member.member, but you should never do
this as that lookup may fail or, worse, return something besides the Enum member you are looking for (this is another good reason to use
all-uppercase names for members)
The changes going in to 3.11 have finally enabled the removal of that behavior, and I am putting documentation-based deprecations in 3.9 and 3.10, but am unable to get code deprecations into the enum code base before 3.11.
Given that the behavior was never officially supported, may I change it in 3.11? It would raise an AttributeError, as it originally did in 3.4.
The text was updated successfully, but these errors were encountered:
In Python 3.5, due to a performance enhancement, it became possible to access one member from another:
This behavior has always been discouraged (from the docs):
The changes going in to 3.11 have finally enabled the removal of that behavior, and I am putting documentation-based deprecations in 3.9 and 3.10, but am unable to get code deprecations into the enum code base before 3.11.
Given that the behavior was never officially supported, may I change it in 3.11? It would raise an
AttributeError
, as it originally did in 3.4.The text was updated successfully, but these errors were encountered: