[Python-checkins] gh-100174: [Enum] Correct PowersOfThree example. (GH-100178)
ethanfurman
webhook-mailer at python.org
Sun Dec 11 18:21:31 EST 2022
https://github.com/python/cpython/commit/868bab0fdc514cfa70ce97e484a689aee8cb5a36
commit: 868bab0fdc514cfa70ce97e484a689aee8cb5a36
branch: main
author: Beweeted <Beweeted at users.noreply.github.com>
committer: ethanfurman <ethan at stoneleaf.us>
date: 2022-12-11T15:20:59-08:00
summary:
gh-100174: [Enum] Correct PowersOfThree example. (GH-100178)
Changed from multiples of 3 to powers of 3 to match the class name.
files:
M Doc/library/enum.rst
diff --git a/Doc/library/enum.rst b/Doc/library/enum.rst
index 295152c69082..25a6e1f0b616 100644
--- a/Doc/library/enum.rst
+++ b/Doc/library/enum.rst
@@ -310,12 +310,12 @@ Data Types
>>> class PowersOfThree(Enum):
... @staticmethod
... def _generate_next_value_(name, start, count, last_values):
- ... return (count + 1) * 3
+ ... return 3 ** (count + 1)
... FIRST = auto()
... SECOND = auto()
...
>>> PowersOfThree.SECOND.value
- 6
+ 9
.. method:: Enum.__init_subclass__(cls, **kwds)
More information about the Python-checkins
mailing list