Ivan Levkivskyi added the comment:

> Maybe we need to take a step back and look at the needs for code that wants 
> to implement runtime type checking more in general?

I would say that the most convenient way for me would be a set of 
"inspect-style" simple helpers like ``is_union``, ``is_generic``, 
``get_parameters`` (similar to inspect.ismethod, inspect.getargspec etc).

> ISTM we have ways to access the parameters of a parameterized type (typically 
> t.__parameters__) but we don't have a reasonable way yet to determine what 
> kind of thing t is.

There is one way that I see right now: using _gorg. For example, 
``_gorg(Tuple[int, str]) is Tuple``, ``_gorg(Callable[..., str]) is Callable``, 
etc. This will also work for ``Union`` if we relax the assert that requires 
type to be instance of GenericMeta (now there is a common internal API used by 
almost everything in typing).

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29262>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to