summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorNicolas A. Oyarzabal <79150521+nicky-eng@users.noreply.github.com>2024-03-08 19:22:17 (GMT)
committerGitHub <noreply@github.com>2024-03-08 19:22:17 (GMT)
commit601f3a7b3391e9d219a8ec44a6c56d00ce584d2a (patch)
tree97e55d2568852e35f531917b5f4c4455231ebfb0 /Doc
parent735fc2cbbcf875c359021b5b2af7f4c29f4cf66d (diff)
downloadcpython-601f3a7b3391e9d219a8ec44a6c56d00ce584d2a.zip
cpython-601f3a7b3391e9d219a8ec44a6c56d00ce584d2a.tar.gz
cpython-601f3a7b3391e9d219a8ec44a6c56d00ce584d2a.tar.bz2
gh-105535 Document potential performance trap during enum creation (GH-107119)
Co-authored-by: Ethan Furman <ethan@stoneleaf.us> Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/enum.rst7
1 files changed, 7 insertions, 0 deletions
diff --git a/Doc/library/enum.rst b/Doc/library/enum.rst
index 49bf40a..d84d9d9 100644
--- a/Doc/library/enum.rst
+++ b/Doc/library/enum.rst
@@ -279,6 +279,8 @@ Data Types
>>> Color.RED.value
1
+ Value of the member, can be set in :meth:`~object.__new__`.
+
.. note:: Enum member values
Member values can be anything: :class:`int`, :class:`str`, etc. If
@@ -286,6 +288,11 @@ Data Types
appropriate value will be chosen for you. See :class:`auto` for the
details.
+ While mutable/unhashable values, such as :class:`dict`, :class:`list` or
+ a mutable :class:`~dataclasses.dataclass`, can be used, they will have a
+ quadratic performance impact during creation relative to the
+ total number of mutable/unhashable values in the enum.
+
.. attribute:: Enum._name_
Name of the member.