The Python Oracle

How can I represent an 'Enum' in Python?

Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn

--

Music by Eric Matyas
https://www.soundimage.org
Track title: Beneath the City Looping

--

Chapters
00:00 Question
00:24 Accepted answer (Score 2955)
02:56 Answer 2 (Score 955)
04:23 Answer 3 (Score 355)
04:42 Answer 4 (Score 221)
05:09 Thank you

--

Full question
https://stackoverflow.com/questions/3693...

Accepted answer links:
[Enums]: https://docs.python.org/3/library/enum.h...
[PEP 435]: http://www.python.org/dev/peps/pep-0435/
[backported to 3.3, 3.2, 3.1, 2.7, 2.6, 2.5, and 2.4]: https://pypi.python.org/pypi/enum34
[aenum library]: https://pypi.python.org/pypi/aenum
[__order__]: https://stackoverflow.com/a/25982264/574...
[typing.Literal]: https://mypy.readthedocs.io/en/stable/li...

Answer 2 links:
[PEP 435]: http://www.python.org/dev/peps/pep-0435/
[Enum]: https://docs.python.org/3/library/enum.h...
[can be converted to lists and are iterable]: https://docs.python.org/3/library/enum.h...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #python3x #enums

#avk47