In python, I know I'm supposed to document instance variables like this:
self.x = 22
"""docstring for x"""
#: docstring for x
self.x = 22
self.x = 22 #: docstring for x
But I can't seem to find a way to get hold of that documentation in code. MyClass.x.__doc__ gives me the doc of the actual type that is in x
So the question is: How do I get "docstring for x" from self.x?
This is a feature of documentation utilities such as Sphinx and Epydoc, not a standard feature of Python. I don't believe that there is any direct way of getting variable docstrings.
See http://epydoc.sourceforge.net/manual-docstring.html#variable-docstrings
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With