Yes, I'm aware of the Enum class but I'm not interested in using it.
This is my Class enum:
class SomeClass:
SOME_STRING = "regular"
SOME_STRING2 = "important"
SOME_STRING3 = "accounts"
SOME_STRING4 = "special"
This is my type-hinted function:
def do_something(*, queue_name: SomeClass):
#....
And when I call it like this:
purge_queue(queue_name=SomeClass.SOME_STRING)
I get a warning:
Argument of type 'Literal['regular']' cannot be assigned to parameter 'queue_name' of type 'SomeClass' 'str' is incompatible with 'SomeClass'
What am I doing wrong?
SomeClass? It sounds like it should just bestr.SomeClass's class variables, well, "one ofSomeClass's class variables" isn't a type.SomeClass's defined values. I know type-hints aren't meant to enforce values, but can they not be used to enforce type? (in this case,SOME_STRINGs are "members" ofSomeClass)