[issue45657] Enum behavior when values are functions
Ronald Pandolfi
report at bugs.python.org
Thu Oct 28 14:27:45 EDT 2021
New submission from Ronald Pandolfi <ronpandolfi at gmail.com>:
Enum members assigned values that are functions don't remember those members. For example:
def my_func():
...
class Test(enum.Enum):
a=1
b=my_func
Test.__members__
Out[7]: mappingproxy({'a': <Test.a: 1>})
Test.b
Out[8]: <function __main__.my_func()>
Even though b doesn't show in __members__ it is still an attribute of the Enum.
----------
messages: 405218
nosy: ronpandolfi
priority: normal
severity: normal
status: open
title: Enum behavior when values are functions
versions: Python 3.10
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45657>
_______________________________________
More information about the Python-bugs-list
mailing list