https://github.com/python/cpython/commit/bdda85ec87f99da9ae12589d90d8a13014fd22ba
commit: bdda85ec87f99da9ae12589d90d8a13014fd22ba
branch: 3.13
author: Miss Islington (bot) <[email protected]>
committer: willingc <[email protected]>
date: 2024-11-01T16:17:35-07:00
summary:

[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 ff257c7843d8ed0dffb6624f2f14996a46e74801)

Co-authored-by: Filip "Ret2Me" Poplewski 
<[email protected]>
Co-authored-by: Ethan Furman <[email protected]>

files:
M Doc/library/enum.rst

diff --git a/Doc/library/enum.rst b/Doc/library/enum.rst
index a724fe4bcdc723..2df9096c452761 100644
--- a/Doc/library/enum.rst
+++ b/Doc/library/enum.rst
@@ -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

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to