summaryrefslogtreecommitdiffstats
path: root/Doc/library/enum.rst
diff options
context:
space:
mode:
authorAlex Waygood <Alex.Waygood@Gmail.com>2021-12-02 16:49:52 (GMT)
committerGitHub <noreply@github.com>2021-12-02 16:49:52 (GMT)
commitb2afdc95cc8f4e9228148730949a43cef0323f15 (patch)
tree00f99a2e959b803ee11434f6866215ac63dc90e6 /Doc/library/enum.rst
parentcb8f491f46e262549f6c447b31625cab7c20a60a (diff)
downloadcpython-b2afdc95cc8f4e9228148730949a43cef0323f15.zip
cpython-b2afdc95cc8f4e9228148730949a43cef0323f15.tar.gz
cpython-b2afdc95cc8f4e9228148730949a43cef0323f15.tar.bz2
bpo-45535: Improve output of Enum ``dir()`` (GH-29316)
Modify the ``EnumType.__dir__()`` and ``Enum.__dir__()`` to ensure that user-defined methods and methods inherited from mixin classes always show up in the output of `help()`. This change also makes it easier for IDEs to provide auto-completion.
Diffstat (limited to 'Doc/library/enum.rst')
-rw-r--r--Doc/library/enum.rst5
1 files changed, 3 insertions, 2 deletions
diff --git a/Doc/library/enum.rst b/Doc/library/enum.rst
index 850b491..572048a 100644
--- a/Doc/library/enum.rst
+++ b/Doc/library/enum.rst
@@ -162,7 +162,8 @@ Data Types
.. method:: EnumType.__dir__(cls)
Returns ``['__class__', '__doc__', '__members__', '__module__']`` and the
- names of the members in *cls*::
+ names of the members in ``cls``. User-defined methods and methods from
+ mixin classes will also be included::
>>> dir(Color)
['BLUE', 'GREEN', 'RED', '__class__', '__doc__', '__members__', '__module__']
@@ -260,7 +261,7 @@ Data Types
.. method:: Enum.__dir__(self)
Returns ``['__class__', '__doc__', '__module__', 'name', 'value']`` and
- any public methods defined on *self.__class__*::
+ any public methods defined on ``self.__class__`` or a mixin class::
>>> from datetime import date
>>> class Weekday(Enum):