PyDocs

Nav

Data Types

Enum._generate_next_value_

enum

staticmethod of Enum · Added in 3.6 (source)
  • Enum._generate_next_value_(name, start, count, last_values)
Generate the next value when not given.

name: the name of the member
start: the initial start value or None
count: the number of existing members
last_values: the list of values assigned
Changed in 3.13
  • 3.13: Prior versions would use the last seen value instead of the highest value.
1 Example
>>> from enum import auto, Enum
>>> class PowersOfThree(Enum):
...     @staticmethod
...     def _generate_next_value_(name, start, count, last_values):
...         return 3 ** (count + 1)
...     FIRST = auto()
...     SECOND = auto()
...
>>> PowersOfThree.SECOND.value
9
from the Python docs
See Also
No see-alsos for enum/Enum._generate_next_value_
0 Notes
No notes for Enum._generate_next_value_