Re:Using Enumerated Types in Python
by BerislavLopac on Sunday June 07, 2020 @04:09AM
(#23445661)
I disagree. A list of strings requires manual validation whether a value is actually in the list; enums have that built in. Additionally, enums (at least in Python) can have behaviour associated with each value, which can be useful in many contexts.
There are also good reasons why Python does not have switch/case statements, which are generally an anti-pattern; they work fine for a quick fix, but what they do is better solved with proper polymorphism.
There are also good reasons why Python does not have switch/case statements, which are generally an anti-pattern; they work fine for a quick fix, but what they do is better solved with proper polymorphism.