ID EN
Enum

_generate_next_value_

Python 3.11

A staticmethod that is used to determine the next value returned by auto:

Syntax

PYTHON
_generate_next_value_(name, start, count, last_values)

Examples

Example 1
PYTHON
>>> from enum import auto
>>> 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

See Also

auto