It hasn’t been a long time since I started digging into the typing system, so please forgive me if these statements are not accurate:
During the implementation of the library I mentioned above, I noticed these problems:
__orig_class__
and__parameters__
are typing module’s internal protocol. Their names and contents are subject to change across versions.- Their availability are not guaranteed. For example
_GenericAliasBase.__call__
will give up if setting attribute__orig_class__
triggers any exception.
This could impose a lot of burdens for a 3rd party type checker to keep up with the stdlib
. They might also suffer from inconsistent behaviors due to unpredictable availability of information.
With that said, I believe going this one step further could provide a more reliable and easy-to-use interface for whoever that wants to do run-time type checking.