Jared Deckard <ja...@shademaps.com> added the comment:

typing_inspect is now filled with python version checks for 3.7. The 
implementation got significantly more complex when differentiating generics at 
runtime.

3.6 was undocumented, but the OO API was intuitive:

>>> T = typing.Union[int, float]
>>> assert T.__class__ == typing.Union
>>> assert T.__args__ == (int, float)

3.7 is less convenient and less consistent:

>>> T = typing.Union[int, float]
>>> assert T.__class__ == typing._GenericAlias
>>> assert T.__origin__ == typing.Union
>>> L = typing.List[int]
>>> assert L.__class__ == typing._GenericAlias
>>> assert L.__origin__ == list

----------
nosy: +Jared Deckard

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

Reply via email to