python - how does one include a variable in the doc string?

Viewed 2913

I'm using the cmd module. there's a command that I'd like to document like this:

def do_this(self,arg)
    "this command accepts these values {values}".format(values="legal values")

the reasoning being I'd like to type that list of legal values only once. I found I can change the docstring later, but I think that's a hack. Is there a way to do this?

2 Answers
Related