I have created a util python file that contains many functions in it. I want to use a long string to be used as a descriptive docstring for some of them, which can be shown with help(functionname)
. Is it possible to write the string just one time and use it for the desired functions (by referring that string from within the functions) as it can be shown with help
?
For example (the main docstring is a long multiline string, here is just as an example):
longstring = """ It is the description """
def hello_():
longstring
return 'hello'
def by_():
longstring
return 'by'
# help(hello_) shows the longstring
I used a code similar to above, but that doesn't show that docstring.