Skip to content

Commit

Permalink
docs: add a more precise example in enum doc (pythonGH-121015)
Browse files Browse the repository at this point in the history
* docs: add a more precise example

Previous example used manual integer value assignment in class based declaration but in functional syntax has been used auto value assignment what could be confusing for the new users. Additionally documentation doesn't show how to declare new enum via functional syntax with usage of the manual value assignment.

* docs: remove whitespace characters

* refactor: change example

---------

(cherry picked from commit ff257c7)

Co-authored-by: Filip "Ret2Me" Poplewski <[email protected]>
Co-authored-by: Ethan Furman <[email protected]>
  • Loading branch information
2 people authored and miss-islington committed Nov 1, 2024
1 parent 2e20a49 commit 755ee2b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Doc/library/enum.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ using function-call syntax::
... BLUE = 3

>>> # functional syntax
>>> Color = Enum('Color', ['RED', 'GREEN', 'BLUE'])
>>> Color = Enum('Color', [('RED', 1), ('GREEN', 2), ('BLUE', 3)])

Even though we can use :keyword:`class` syntax to create Enums, Enums
are not normal Python classes. See
Expand Down

0 comments on commit 755ee2b

Please sign in to comment.