[Python-checkins] gh-100174: [Enum] Correct PowersOfThree example. (GH-100178)

miss-islington webhook-mailer at python.org
Sun Dec 11 18:30:33 EST 2022


https://github.com/python/cpython/commit/593c5a02470c063e1dcaf5df5f397294067d0a80
commit: 593c5a02470c063e1dcaf5df5f397294067d0a80
branch: 3.11
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2022-12-11T15:30:25-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.
(cherry picked from commit 868bab0fdc514cfa70ce97e484a689aee8cb5a36)

Co-authored-by: Beweeted <Beweeted at users.noreply.github.com>

files:
M Doc/library/enum.rst

diff --git a/Doc/library/enum.rst b/Doc/library/enum.rst
index be0686203bd1..b7b4b949790b 100644
--- a/Doc/library/enum.rst
+++ b/Doc/library/enum.rst
@@ -316,11 +316,11 @@ 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