mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
[3.11] gh-105535 Document potential performance trap during enum creation (GH-107119) (GH-116512)
(cherry picked from commit 601f3a7b33
)
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>
This commit is contained in:
parent
3abf267787
commit
232b085a01
1 changed files with 7 additions and 0 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue