Python has a PEP (257) that defines Docstring Conventions. Regarding documentation of attributes, it states:
String literals occurring immediately
after a simple assignment at the top
level of a module, class, or__init__
method are called “attribute
docstrings”.
So the following are considered documented attributes:
class Foo(object):
velocity = 1
"""Foo's initial velocity - class variable"""
def __init__(self, args):
self.location = 0.0
"""Foo's initial location - instance variable"""
(Edit: Fixed second docstring)