[issue45535] Enum's dir() does not contain inherited members

Alex Waygood report at bugs.python.org
Thu Oct 21 12:53:10 EDT 2021


Alex Waygood <Alex.Waygood at Gmail.com> added the comment:

I had a go at writing a patch for `__dir__` that would include any methods an enum class had acquired through `int`/`str`/etc. mixins, while continuing to ignore enum dunders and sunders (as is currently the case). My patch also allows user-defined methods defined in enum subclasses to show up in the `help()` output, whereas they currently do not, since `help(enum_member)` looks up `dir(enum_class)` rather than `dir(enum_member)`.

The patch is a fair way more complex than the the existing code, however.

----------
nosy: +AlexWaygood
Added file: https://bugs.python.org/file50382/Enum_dir_patch.txt

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45535>
_______________________________________


More information about the Python-bugs-list mailing list