How can I reference a method, decorated with @property
?
For simple methods, :py:meth:
is working fine, but not for properties: it does not create a link to them.
You should use :py:attr:
instead. This example works fine for me:
class SomeClass(object):
"""This is the docstring of SomeClass."""
@property
def some_property(self):
"""This is the docstring of some_property"""
return None
def some_method(self):
"""This is the docstring of some_method.
And this is a reference to :py:attr:`~some_property`
"""
This works for me. It renders MyClass.my_prop
with the proper link.
:attr:`.MyClass.my_prop`
This renders just my_prop
, with the same link.
:attr:`~.MyClass.my_prop`
I use :py:obj:
instead.
:py:attr:
won't work for me when the property is in another page.
:py:attr:
with the property?:py:attr:
too. Nothing changed: the link does not appear.functools.wraps
to retain the wrapped function's documentation? Could you provide an example of what you're doing, and the expected and actual output?