docs: add a more precise example in enum doc (GH-121015)

* 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

---------

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
This commit is contained in:
Filip "Ret2Me" Poplewski 2024-11-01 20:28:50 +01:00 committed by GitHub
parent 37651cfbce
commit ff257c7843
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -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