Repetitive content in docstrings

Posted by Morgoth on Stack Overflow See other posts from Stack Overflow or by Morgoth
Published on 2010-04-04T21:26:21Z Indexed on 2010/04/04 21:33 UTC
Read the original article Hit count: 529

Filed under:
|

What are good ways to deal with repetitive content in docstrings? I have many functions that take 'standard' arguments, which have to be explained in the docstring, but it would be nice to write the relevant parts of the docstring only once, as this would be much easier to maintain and update. I naively tried the following:

arg_a = "a: a very common argument"

def test(a):
    '''
    Arguments:
    %s
    ''' % arg_a
    pass

But this does not work, because when I do help(test) I don't see the docstring. Is there a good way to do this?

© Stack Overflow or respective owner

Related posts about python

Related posts about docstring