This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author McSinyx
Recipients McSinyx, docs@python
Date 2019-12-23.15:40:00
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1577115600.68.0.0436692507171.issue39125@roundup.psfhosted.org>
In-reply-to
Content
Dear Maintainer,

I want to request a feature on the generative documentation of type-hinting.
As of December 2019, I believe there is no support for generating such
information in help().  For demonstration, I have this tiny piece of code

class Foo:
    @property
    def bar(self) -> int: return 42

    @bar.setter
    def bar(self, value: int) -> None: pass

    def baz(self, arg: float) -> str: pass

whose documentation on CPython 3.7.5 (on Debian testing amd64 if that matters)
is generated as

class Foo(builtins.object)
 |  Methods defined here:
 |  
 |  baz(self, arg: float) -> str
 |  
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |  
 |  __dict__
 |      dictionary for instance variables (if defined)
 |  
 |  __weakref__
 |      list of weak references to the object (if defined)
 |  
 |  bar

I expect the documentation for bar to be as informative as bar, i.e. something
similar to ``bar: int''.  As pointed out by ChrisWarrick on freenode#python,
the annotations are already present, yet help() is not making use of them:

>>> Foo.bar.fget.__annotations__
{'return': <class 'int'>}
>>> Foo.bar.fset.__annotations__
{'value': <class 'int'>, 'return': None}

Have a Merry Christmas or other holiday of your choice,
Nguyễn Gia Phong
History
Date User Action Args
2019-12-23 15:40:00McSinyxsetrecipients: + McSinyx, docs@python
2019-12-23 15:40:00McSinyxsetmessageid: <1577115600.68.0.0436692507171.issue39125@roundup.psfhosted.org>
2019-12-23 15:40:00McSinyxlinkissue39125 messages
2019-12-23 15:40:00McSinyxcreate