I am a python programmer and I write a lot of doctests, which is a python module that allows you to write tests as examples of function's usage in the documentation string of every function. Have a look at the example from here:
def factorial(n):
"""Return the factorial of n, an exact integer >= 0.
If the result is small enough to fit in an int, return an int.
Else return a long.
>>> [factorial(n) for n in range(6)]
[1, 1, 2, 6, 24, 120]
"""
The two last lines are an example of the usage of the function, and can be executed using the doctest module. This way, you accomplish that:
- you put an example of usage of the function, so your users will know how to use it;
- if you include the test in your test suite and run tests often, you will be noticed if the example get broken by a change in the code
- it doesn't take too much time to write these kind of examples.
I usually start with creating stub functions and writing the doctests, to have an idea of how each function will work and which are the expected inputs/outputs; thank to this approach, I always have at least a short documentation of every function and module I write.
From time to time, I write a longer document explaining how my modules can be used (for my colleagues) and I always use the doctest syntax; however, reguarding your question, I never do more than this, sometimes I can write a blog comment on my work or on a library I wrote, but I don't have the time to write longer documentation.