Skip to content

Instantly share code, notes, and snippets.

@klauer
Last active January 30, 2016 14:49
Show Gist options
  • Save klauer/e6275ccd0ae68b4e20c6 to your computer and use it in GitHub Desktop.
Save klauer/e6275ccd0ae68b4e20c6 to your computer and use it in GitHub Desktop.
string enum
StrEnum.doc_a
True
StrEnum.doc_a = A
import enum
class StrEnum(str, enum.Enum):
doc_a = 'A'
doc_b = 'B'
doc_c = 'C'
a = StrEnum('A')
print(a)
print(a == 'A')
print(str(a), '=', a.value)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment