behavior with the help function · Issue #279 · python/typing (original) (raw)
I like the idea of type hint provided by this module, and I would like to use it more often but what stop me for doing so is the lost of information in the automatically generate documentation for the function I annotate using this module, take this for example
from typing import Iterator
def fib() -> Iterator[int]:
"""A generator of blah blah"""
...
when calling help
in that function (or the little hint that pop up in the idle) I get the following
>>> help(fib)
Help on function fib in module __main__:
fib() -> typing.Iterator
A generator of blah blah
>>>
as you can see I lost information about fib
as I clearly annotate it a iterator of int but that is not reflected in the help in any way as all the internal structure/details that I put in the annotations are lost. The same apply for all the others members of typing
So I would like to get from the above example the following output
>>> help(fib)
Help on function fib in module __main__:
fib() -> Iterator[int]
A generator of blah blah
>>>
which is more helpful and with just a glance I know what I am getting or need from/for the function.