David E. Franco G. added the comment:

I think that removing the "typing." is for the best, with the example above 

>>> help(foo)
Help on function foo in module __main__:

foo(data:typing.List[typing.Any]) -> typing.Iterator[typing.Tuple[int, 
typing.Any]]

>>> 


leaving the "typing." produce result that I think are ugly and distracting, not 
only that, is unnecessary long to convey the same information that can be in a 
more neat way without it, and more so while more complicated/long the signature 
is. 

just compare the above with this

>>> help(foo)
Help on function foo in module __main__:

foo(data:List[Any]) -> Iterator[Tuple[int, Any]]:

>>> 

which is a clear winner to me.

Or perhaps alongside modifying inspect.formatannotation also change the 
__repr__ in typing to exclude the `typing.` or like with for instance TypeVar 
produce a repr that include some marker instead, like ~ and in that way 
indicate that one is using typing object resulting in something like this

>>> help(foo)
Help on function foo in module __main__:

foo(data:~List[Any]) -> ~Iterator[~Tuple[int, ~Any]]:

>>> 

which is a little weird but still neat

----------

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

Reply via email to