I Spy Code - Python

Docstring

A docstring is a string literal that occurs as the first statement in a module, function, class, or method definition. Such a docstring becomes the __doc__ special attribute of that object.

Here is a python example that shows how to add a docstring to a class.

Source: (example.py)

class MyClass:
  """
  This is the MyClass docstring
  """
 
print MyClass.__doc__
 

Output:

$ python example.py

  This is the MyClass docstring