[issue29262] Provide a way to check for *real* typing.Union instances

Guido van Rossum report at bugs.python.org
Sun Jan 15 17:37:42 EST 2017


Guido van Rossum added the comment:

Hm, let me back-pedal a bit. The situation with Callable is murky, as e.g. isinstance(typing.Tuple[int, int], typing.Callable) returns True.

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? 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.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29262>
_______________________________________


More information about the Python-bugs-list mailing list