mirror of
https://github.com/python/cpython.git
synced 2025-08-22 01:35:16 +00:00
gh-100174: [Enum] Correct PowersOfThree example. (GH-100178)
Changed from multiples of 3 to powers of 3 to match the class name.
(cherry picked from commit 868bab0fdc
)
Co-authored-by: Beweeted <Beweeted@users.noreply.github.com>
This commit is contained in:
parent
606adb4b89
commit
593c5a0247
1 changed files with 2 additions and 2 deletions
|
@ -316,11 +316,11 @@ Data Types
|
||||||
>>> class PowersOfThree(Enum):
|
>>> class PowersOfThree(Enum):
|
||||||
... @staticmethod
|
... @staticmethod
|
||||||
... def _generate_next_value_(name, start, count, last_values):
|
... def _generate_next_value_(name, start, count, last_values):
|
||||||
... return (count + 1) * 3
|
... return 3 ** (count + 1)
|
||||||
... FIRST = auto()
|
... FIRST = auto()
|
||||||
... SECOND = auto()
|
... SECOND = auto()
|
||||||
>>> PowersOfThree.SECOND.value
|
>>> PowersOfThree.SECOND.value
|
||||||
6
|
9
|
||||||
|
|
||||||
.. method:: Enum.__init_subclass__(cls, **kwds)
|
.. method:: Enum.__init_subclass__(cls, **kwds)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue