I have a script that uses the cmd Python module. The cmd module uses a triple quoted multiline string as it’s help text. Something like this
def x(self, strags = None): '''class help text here and some more help text here'''
When running the script, the command ‘help x’ will print the string. It will, however, print the newlines in front of the last two lines as well. I can overcome this by not indenting these lines, but that’ll make my code ugl{y,ier}.
How to overcome this indenting problem? How do the pro Python coders handle this?
Personally I try to follow PEP 8 which refers the reader to PEP 257 for Docstring Conventions. It has an entire section on multi-line docstrings.