Message358823
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 |
|
Date |
User |
Action |
Args |
2019-12-23 15:40:00 | McSinyx | set | recipients:
+ McSinyx, docs@python |
2019-12-23 15:40:00 | McSinyx | set | messageid: <1577115600.68.0.0436692507171.issue39125@roundup.psfhosted.org> |
2019-12-23 15:40:00 | McSinyx | link | issue39125 messages |
2019-12-23 15:40:00 | McSinyx | create | |
|