Assuming I have a file example.py with the following contents:
class Body(object): """Representation of a geometric body.""" def __init__(self): self.surface = Surface(self) class Surface(object): """Representation of a geometric surface.""" def __init__(self, body): self.body = body def get_surface_area(self): """ Calculate surface area of the body """ print 4 mybody = Body() mybody.surface.get_surface_area() When I do
.. automodule:: example :members: I get all the two classes and the function documented. However, how would I go about pointing out the intended usage of my class, i.e. mybody.surface.get_surface_area() and also have the correct links in place?
get_surface_area?!:ivar surface: interface for :class:example.Surface` and have a link to the class. Still unsure if it is clear to the reader that you can domybody.surface.get_surface_area()instead ofmysurface = Surface(mybody); mysurface.get_surface_area().