[3.12] Fix note in Enum.__new__ docs (GH-118284) (#118325)

(cherry picked from commit 5a4d3df2fa)

Co-authored-by: Philipp A <flying-sheep@web.de>
This commit is contained in:
Jelle Zijlstra 2024-04-26 16:25:31 -07:00 committed by GitHub
parent ef12d239fa
commit 186fbe82f7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -269,7 +269,7 @@ Data Types
>>> Color.RED.value >>> Color.RED.value
1 1
Value of the member, can be set in :meth:`~object.__new__`. Value of the member, can be set in :meth:`~Enum.__new__`.
.. note:: Enum member values .. note:: Enum member values
@ -289,7 +289,7 @@ Data Types
.. attribute:: Enum._value_ .. attribute:: Enum._value_
Value of the member, can be set in :meth:`~object.__new__`. Value of the member, can be set in :meth:`~Enum.__new__`.
.. attribute:: Enum._order_ .. attribute:: Enum._order_
@ -397,7 +397,7 @@ Data Types
results in the call ``int('1a', 16)`` and a value of ``17`` for the member. results in the call ``int('1a', 16)`` and a value of ``17`` for the member.
..note:: When writing a custom ``__new__``, do not use ``super().__new__`` -- .. note:: When writing a custom ``__new__``, do not use ``super().__new__`` --
call the appropriate ``__new__`` instead. call the appropriate ``__new__`` instead.
.. method:: Enum.__repr__(self) .. method:: Enum.__repr__(self)
@ -817,7 +817,7 @@ Supported ``__dunder__`` names
:attr:`~EnumType.__members__` is a read-only ordered mapping of ``member_name``:``member`` :attr:`~EnumType.__members__` is a read-only ordered mapping of ``member_name``:``member``
items. It is only available on the class. items. It is only available on the class.
:meth:`~object.__new__`, if specified, must create and return the enum members; it is :meth:`~Enum.__new__`, if specified, must create and return the enum members; it is
also a very good idea to set the member's :attr:`!_value_` appropriately. Once also a very good idea to set the member's :attr:`!_value_` appropriately. Once
all the members are created it is no longer used. all the members are created it is no longer used.