Author levkivskyi
Recipients evan_, flying sheep, gvanrossum, levkivskyi
Date 2017-01-15.22:48:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1484520531.13.0.674627680751.issue29262@psf.upfronthosting.co.za>
In-reply-to
Content
> 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).
History
Date User Action Args
2017-01-15 22:48:51levkivskyisetrecipients: + levkivskyi, gvanrossum, flying sheep, evan_
2017-01-15 22:48:51levkivskyisetmessageid: <1484520531.13.0.674627680751.issue29262@psf.upfronthosting.co.za>
2017-01-15 22:48:51levkivskyilinkissue29262 messages
2017-01-15 22:48:50levkivskyicreate