string interpolation in doc strings...
Barry A. Warsaw
bwarsaw at cnri.reston.va.us
Fri Dec 10 01:51:09 EST 1999
>>>>> "SM" == Skip Montanaro <skip at mojam.com> writes:
SM> I imagine some of the active particpants in the doc sig will
SM> have some opinions about the use of format strings embedded in
SM> doc strings. It's not immediately obvious to me that it's
SM> good docstring stewardship.
That's a good point Skip. Looking back over my use of this, it's
fairly limited to things like
PROGRAM = sys.argv[0]
__version__ == '0.1'
and then interpolating just those two globals into the docstring.
Very occasionally, it'll be something more, but it's also just as
likely that I might generate dynamic information to tack onto the end
of the script's module docstring.
Lately, I haven't been doing any of that though, and just printing
__doc__ in the usage() function. That alone is a mighty handy way of
doing it.
-Barry
More information about the Python-list
mailing list