I'm trying to understand why Literal["a", "b", "c"] results in an object derived from _GenericAlias. It's not using TypeVar substitutions, so it's not generic per se. Is it just to provide the origin and arguments semantics?
That said, would would be the best way to distinguish between a "real" generic alias from literals and unions (both of which derive from _GenericAlias)?
In [23]: typing.get_origin(typing.Literal[1, 2, 3]) is typing.Literal
Out[23]: True
_______________________________________________
Typing-sig mailing list -- typing-sig@python.org
To unsubscribe send an email to typing-sig-leave@python.org
https://mail.python.org/mailman3/lists/typing-sig.python.org/
Member address: jelle.zijlstra@gmail.com