]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-100174: [Enum] Correct PowersOfThree example. (GH-100178)
authorBeweeted <Beweeted@users.noreply.github.com>
Sun, 11 Dec 2022 23:20:59 +0000 (15:20 -0800)
committerGitHub <noreply@github.com>
Sun, 11 Dec 2022 23:20:59 +0000 (15:20 -0800)
Changed from multiples of 3 to powers of 3 to match the class name.

Doc/library/enum.rst

index 295152c690827177e0d8be337d44d6cfdf31f74f..25a6e1f0b61677ac82000c224887b3dfdd7f90b8 100644 (file)
@@ -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)