Message285525
Maybe a proposal should be discussed as an addendum to PEP 484? Or would
Mark Shannon reject that?
On Sun, Jan 15, 2017 at 2:48 PM, Ivan Levkivskyi <report@bugs.python.org>
wrote:
>
> 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 <report@bugs.python.org>
> <http://bugs.python.org/issue29262>
> _______________________________________
> |
|
Date |
User |
Action |
Args |
2017-01-15 22:50:57 | gvanrossum | set | recipients:
+ gvanrossum, flying sheep, levkivskyi, evan_ |
2017-01-15 22:50:57 | gvanrossum | link | issue29262 messages |
2017-01-15 22:50:56 | gvanrossum | create | |
|