]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-100174: [Enum] Correct PowersOfThree example. (GH-100178)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sun, 11 Dec 2022 23:30:25 +0000 (15:30 -0800)
committerGitHub <noreply@github.com>
Sun, 11 Dec 2022 23:30:25 +0000 (15:30 -0800)
Changed from multiples of 3 to powers of 3 to match the class name.
(cherry picked from commit 868bab0fdc514cfa70ce97e484a689aee8cb5a36)

Co-authored-by: Beweeted <Beweeted@users.noreply.github.com>
Doc/library/enum.rst

index be0686203bd184937513b9b4a8c039194daa38c8..b7b4b949790be3436ae178a567c3026ff07bb6ae 100644 (file)
@@ -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)