Bob Ippolito (@etrepum) on Haskell, Python, Erlang, JavaScript, etc.
«

Making docutils do python syntax highlighting (for HTML output)

»

http://undefined.org/python/docpytils-0.0.tgz is a simple docutils directive that does simple python syntax highlighting in ReST.. basically, after importing docpytils, you can do something like this:

.. pycode::

    python code here..

Like raw, you can also use :file: or :url: as arguments.

Output will look like this:

>>> from __future__ import *
  File "<stdin">, line 1
SyntaxError: future statement does not support import *
>>>