]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.11] gh-105535 Document potential performance trap during enum creation (GH-107119...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sat, 9 Mar 2024 00:57:16 +0000 (01:57 +0100)
committerGitHub <noreply@github.com>
Sat, 9 Mar 2024 00:57:16 +0000 (16:57 -0800)
(cherry picked from commit 601f3a7b3391e9d219a8ec44a6c56d00ce584d2a)

Co-authored-by: Nicolas A. Oyarzabal <79150521+nicky-eng@users.noreply.github.com>
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Doc/library/enum.rst

index 5516eaaf1ef0ff18abbc1a98c94f3f728561a342..ff390897deded6d5cc2a058ad14ddbe6d6e87bcd 100644 (file)
@@ -270,6 +270,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
@@ -277,6 +279,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.