IPython dynamic object introspection can't support Python3.9 Generic Alias Type properly now, there is an example:
Python 3.8.6, IPython 7.19.1
Python 3.8.6 (tags/v3.8.6:db45529, Sep 23 2020, 15:52:53) [MSC v.1927 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 7.19.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: from typing import Iterable, Tuple
In [2]: def gen(n: int) -> Iterable[Tuple[str, int]]:
...: for i in range(n):
...: yield (str(i), i)
...:
In [3]: gen?
Signature: gen(n: int) -> Iterable[Tuple[str, int]]
Docstring: <no docstring>
File: c:\users\galaxysnail\<ipython-input-2-fdd2e6ab754a>
Type: function
In [4]:
Python 3.9.1, IPython 7.19.1
Python 3.9.1 (tags/v3.9.1:1e5d33e, Dec 7 2020, 17:08:21) [MSC v.1927 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 7.19.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: from collections.abc import Iterable
In [2]: def gen(n: int) -> Iterable[tuple[str, int]]:
...: for i in range(n):
...: yield (str(i), i)
...:
In [3]: gen?
Signature: gen(n: int) -> collections.abc.Iterable
Docstring: <no docstring>
File: c:\users\galaxysnail\<ipython-input-2-d1df2012a6b8>
Type: function
In [4]:
Return type is expected to be Iterable[Tuple[str, int]], but it is collections.abc.Iterable on Python3.9 now.
IPython dynamic object introspection can't support Python3.9 Generic Alias Type properly now, there is an example:
Python 3.8.6, IPython 7.19.1
Python 3.9.1, IPython 7.19.1
Return type is expected to be
Iterable[Tuple[str, int]], but it iscollections.abc.Iterableon Python3.9 now.