https://github.com/python/cpython/commit/d5d86e2145d11d6e844ee987780445c6ebce4309 commit: d5d86e2145d11d6e844ee987780445c6ebce4309 branch: 3.12 author: Miss Islington (bot) <[email protected]> committer: ethanfurman <[email protected]> date: 2024-03-08T16:56:58-08:00 summary:
[3.12] gh-105535 Document potential performance trap during enum creation (GH-107119) (GH116511) (cherry picked from commit 601f3a7b3391e9d219a8ec44a6c56d00ce584d2a) Co-authored-by: Nicolas A. Oyarzabal <[email protected]> Co-authored-by: Ethan Furman <[email protected]> Co-authored-by: Hugo van Kemenade <[email protected]> files: M Doc/library/enum.rst diff --git a/Doc/library/enum.rst b/Doc/library/enum.rst index 28dae4288d3c05..bc5b3d7cd4c095 100644 --- a/Doc/library/enum.rst +++ b/Doc/library/enum.rst @@ -269,6 +269,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 @@ -276,6 +278,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. _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-checkins.python.org/ Member address: [email protected]
