When I have a list of possible options for a value I usually used an enum. So for example let’s say:
class Options(Enum):
Option1 = "Option 1"
Option2 = "Option 2"
Option3 = "Option 3"
and I’ve never had any problem, it always worked perfectly. However, recently I came across with the concept of Literal
, and I don’t really understand the difference. They seem that they are use in the exact same scenarios (which I guess they don’t), but I couldn’t find any info on when to use each and why.
Is there any guideline for this? Does anybody have any experience on when is better to use each one?