Message274814
as that is the case, how about this as a solution:
def formatannotation(annotation, base_module=None):
if isinstance(annotation, type):
if annotation.__module__ in ('builtins', base_module):
return annotation.__qualname__
elif annotation.__module__ in ('typing', base_module):
return repr(annotation).replace("typing.","")
return annotation.__module__+'.'+annotation.__qualname__
return repr(annotation)
the same way that it check for builtins, do it for typing and clean up a little.
With that change the result with the example is
>>> help(foo)
Help on function foo in module __main__:
foo(data:List[Any]) -> Iterator[Tuple[int, Any]]
>>> |
|
Date |
User |
Action |
Args |
2016-09-07 14:18:47 | David E. Franco G. | set | recipients:
+ David E. Franco G., gvanrossum, Spencer Brown |
2016-09-07 14:18:47 | David E. Franco G. | set | messageid: <1473257927.13.0.313458686726.issue27989@psf.upfronthosting.co.za> |
2016-09-07 14:18:47 | David E. Franco G. | link | issue27989 messages |
2016-09-07 14:18:47 | David E. Franco G. | create | |
|