While looking up some Python docs generated by the excellent Sphinx documentation tool1, I noticed that Sphinx can show/hide the prompts and output in a code snippet. This allows the user to see the full code and output, but then can hit a button and get text suitable for cut-and-pasting onto the command line to try it for themselves. Check out my simple experiment to see how it works.

I will definitely have to work this into an IDLdoc release soon.

  1. Sphinx is somewhat the Python equivalent to IDLdoc, but much more general.