I’m trying to write a function that would only except a specific enum that each value is a string so the function could not except a string but would get the wanted value from the enum
from enum import Enum
class Options(Enum):
A = "a"
B = "b"
C = "c"
def some_func(option: Options):
# some code
return option
The problem I’m experiencing is that if I check the type I get this instead of a string:
>>> type(Options.A)
<enum 'Options'>
I would like to have it return this:
>>> type(Options.A)
<class 'str'>
Any idea how I can implement this so it would work the way I intended? Thanks in advance