It all depends.
If the constants are logically integer (with them arithmetic, bitwise logics, etc.), they should be regular global variables. The flag values ββfall here, as for the various os.open() flags, but if you just specified a constant to indicate which operation to perform, the enumeration is more suitable (or, even better, several driver functions).
Enumerated types are usually used when you have a (relatively) small set of values, and these values ββare mainly compared only with each other (for example, if x is MyEnum.FIRST... elif x is MyEnum.SECOND , etc. ) In this case, you usually do not need IntEnum , because you should not often use .value to get started. In fact, IntEnum is basically a backward compatibility hack.
Kevin source share