docstrings

François Pinard pinard at iro.umontreal.ca
Thu Apr 20 14:07:39 EDT 2000


Ben Wolfson <rumjuggler at home.com> writes:

> is there a way to use %c and %s within a docstring, or to add strings
> together in a docstring, so that if some strings are used in all
> docstrings, but might be changed, I can simply change one or two
> variables?

You could merely write docstrings as formats, using %(VARIABLE)s notation.
Then, whenever you want to process it, just use __doc__ % locals(), or
more generally __doc__ % DICTIONARY, with a suitable DICTIONARY.

-- 
François Pinard   http://www.iro.umontreal.ca/~pinard






More information about the Python-list mailing list