August 2018
Intermediate to advanced
366 pages
10h 14m
English
IntEnum is an integer, apart from the fact that all possible values are created when the class is defined. IntEnum inherits from int, so its values are real integers.
During the RequestType definition, all the possible values for enum are declared within the class body and the values are verified against duplicates by the metaclass.
Also, enum provides support for a special value, auto, which means just put in a value, I don't care. As you usually only care whether it's POST or GET, you usually don't care whether POST is 1 or 2.
Last but not least, enumerations cannot be subclassed if they define at least one possible value.