[New-bugs-announce] [issue45535] Enum's dir() does not contain inherited members
Serhiy Storchaka
report at bugs.python.org
Wed Oct 20 06:35:06 EDT 2021
New submission from Serhiy Storchaka <storchaka+cpython at gmail.com>:
For example:
>>> from enum import *
>>> class E(IntEnum):
... x = 1
...
>>> dir(E)
['__class__', '__doc__', '__members__', '__module__', 'x']
>>> E.from_bytes
<built-in method from_bytes of EnumType object at 0x559d47415ce0>
>>> E.to_bytes
<method 'to_bytes' of 'int' objects>
>>> E.numerator
<attribute 'numerator' of 'int' objects>
>>> E.__add__
<slot wrapper '__add__' of 'int' objects>
There are methods and attributes inherited from int, but they are not shown in dir(). As result they are absent in help() and completion does not work for them.
----------
components: Library (Lib)
messages: 404420
nosy: barry, eli.bendersky, ethan.furman, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Enum's dir() does not contain inherited members
type: behavior
versions: Python 3.10, Python 3.11, Python 3.9
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45535>
_______________________________________
More information about the New-bugs-announce
mailing list