Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

behavior with the help function #279

Closed
copperfield42 opened this issue Sep 6, 2016 · 2 comments
Closed

behavior with the help function #279

copperfield42 opened this issue Sep 6, 2016 · 2 comments

Comments

@copperfield42
Copy link

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.

@gvanrossum
Copy link
Member

Thanks for the bug report! This turns out to be a bug in Python's inspect module. E.g. signature(fib) returns the same incomplete signature. It's also possible that the help() function needs to be modified to support this. Can you report the bug at bugs.python.org?

@copperfield42
Copy link
Author

sure, here is the report I made http://bugs.python.org/issue27989

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants