Code example:
class A(object):
def do_something(self):
""" doc_a """
def inside_function():
""" doc_b """
pass
pass
I tried:
.. autoclass:: A
.. autofunction:: A.do_something.inside_function
but it doesn’t work.
Is there some way to generate doc_b for me?
A function within a function is at the local variable scope. The local variables of a function are not accessible from outside of the function:
If Sphinx can’t get a reference to the function, it can’t document it.
A workaround that might work is to assign the function to a variable of the function, like this:
It won’t be accessible at first:
But after the first invocation of the function, it will be:
This might work if the function gets executed when Sphinx imports the module.