[issue45657] Enum behavior when values are functions

2021-10-28 Thread Ronald Pandolfi
Ronald Pandolfi added the comment: Ok, yeah that works. I would have thought that __members__ could be able to differentiate between bound methods and external functions, but that's probably asking too much. Fair enough! This works so I'm happy. Closing, "not a bug"... -- resolution

[issue45657] Enum behavior when values are functions

2021-10-28 Thread Alex Waygood
Alex Waygood added the comment: It would be difficult to define methods in Enum classes if functions in the class namespace were automatically converted into members. You can get around this by wrapping your functions in `functools.partial` objects; see https://stackoverflow.com/questions/40

[issue45657] Enum behavior when values are functions

2021-10-28 Thread Ronald Pandolfi
New submission from Ronald Pandolfi : 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.b Out[8]: Even though b doesn't show i