[issue39125] Type signature of @property not shown in help()

Karthikeyan Singaravelan report at bugs.python.org
Mon Dec 23 11:37:13 EST 2019


Karthikeyan Singaravelan <tir.karthi at gmail.com> added the comment:

Currently docstring written for even property.setter is ignored in help as inspect.getdoc only inspects property.fget [0] for docstrings. I feel docs for setter could also be included. The docs also indicate the same at https://docs.python.org/3.6/library/functions.html#property . In the absence of docs maybe the signature for getter and setter could be included as per this proposal.

class Foo:
    @property
    def bar(self) -> int:
        '''Bar docs for property'''
        return 42

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

help(Foo.bar)

Help on property:

    Bar docs for property


[0] https://github.com/python/cpython/blob/4b3b1226e86df6cd45e921c8f2ad23c3639c43b2/Lib/inspect.py#L580

----------
nosy: +rhettinger, xtreak
versions:  -Python 3.5, Python 3.6, Python 3.7, Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39125>
_______________________________________


More information about the Python-bugs-list mailing list