Open cunningjames opened 3 years ago
I am having the same problem with:
@enforce_types
@dataclass
class Bar:
task: Literal["regression", "classification"]
So I saw the decorator at this point checks the following statement which is obviously wrong:
isinstance('classification', ("regression", "classification"))
Should we extend this module's functionality to include Literals correctly?
Right now, using
Literal[x]
wherex
is not a type raises an error:This is because
Literal[x]
passes thetyping. _SpecialForm
check, but the code then expectsx
to be a type. This means the following (which I don't think makes sense) passes without an error: