mirror of https://github.com/python/cpython
standardize Enum docs by referring to 'special methods' instead of __dunder__ methods
This commit is contained in:
parent
8912270629
commit
8be6fac103
|
@ -314,11 +314,11 @@ Then::
|
||||||
>>> str(Mood.funky)
|
>>> str(Mood.funky)
|
||||||
'my custom str! 1'
|
'my custom str! 1'
|
||||||
|
|
||||||
The rules for what is allowed are as follows: _sunder_ names (starting and
|
The rules for what is allowed are as follows: names that start and end with a
|
||||||
ending with a single underscore) are reserved by enum and cannot be used;
|
with a single underscore are reserved by enum and cannot be used; all other
|
||||||
all other attributes defined within an enumeration will become members of this
|
attributes defined within an enumeration will become members of this
|
||||||
enumeration, with the exception of *__dunder__* names and descriptors (methods
|
enumeration, with the exception of special methods (:meth:`__str__`,
|
||||||
are also descriptors).
|
:meth:`__add__`, etc.) and descriptors (methods are also descriptors).
|
||||||
|
|
||||||
Note: if your enumeration defines :meth:`__new__` and/or :meth:`__init__` then
|
Note: if your enumeration defines :meth:`__new__` and/or :meth:`__init__` then
|
||||||
whatever value(s) were given to the enum member will be passed into those
|
whatever value(s) were given to the enum member will be passed into those
|
||||||
|
|
Loading…
Reference in New Issue