mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
[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:
parent
ef12d239fa
commit
186fbe82f7
1 changed files with 5 additions and 5 deletions
|
@ -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.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue