We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ac3aef1 commit fd84e42Copy full SHA for fd84e42
Doc/library/enum.rst
@@ -510,15 +510,20 @@ Data Types
510
of the enumeration.
511
512
>>> from enum import StrEnum
513
- >>> class Name(StrEnum):
514
- ... IDENTIFIER = 'id'
515
- ... PROPERTY = 'pro'
516
- ... ATTRIBUTE = 'attr'
517
- ...
518
- >>> Name.IDENTIFIER
519
- <Name.IDENTIFIER: 'id'>
520
- >>> str(Name.IDENTIFIER)
521
- 'id'
+ >>> class Color(StrEnum):
+ ... RED = 'r'
+ ... GREEN = 'g'
+ ... BLUE = 'b'
+ ... UNKNOWN = auto()
+ ...
+ >>> Color.RED
+ <Color.RED: 'r'>
+ >>> str(Color.RED)
522
+ 'r'
523
+ >>> Color.UNKNOWN
524
+ <Color.UNKNOWN: 'unknown'>
525
+ >>> str(Color.UNKNOWN)
526
+ 'unknown'
527
528
.. note::
529
0 commit comments