Skip to content

Commit bdda85e

Browse files
miss-islingtonRet2Meethanfurman
authored
[3.13] docs: add a more precise example in enum doc (GH-121015) (#126306)
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 --------- (cherry picked from commit ff257c7) Co-authored-by: Filip "Ret2Me" Poplewski <[email protected]> Co-authored-by: Ethan Furman <[email protected]>
1 parent f8a9a1c commit bdda85e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Doc/library/enum.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ using function-call syntax::
4444
... BLUE = 3
4545

4646
>>> # functional syntax
47-
>>> Color = Enum('Color', ['RED', 'GREEN', 'BLUE'])
47+
>>> Color = Enum('Color', [('RED', 1), ('GREEN', 2), ('BLUE', 3)])
4848

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

0 commit comments

Comments
 (0)