I am making a script that might be run as a module, and want to sync the docstring between them, how do I do this.
In this example, I want all the different docstrings to come from one place so future edits do not need to worry about the keeping the descriptions inline with each other.
(Note: argparse is a built-in python library for parsing command line arguments, the only important part here is that it exists and needs the description)
#!/usr/bin/env python3
"""
My long description
"""
import argparse
program_description = """My long description"""
def main():
"""
My long description
"""
if __name__ == "__main__":
main()
argparse.ArgumentParser(description=program_description)
How do I reduce the repletion on the docstrings so I don’t need to change 3 locations when I change the description? (If it can be reduced to 2 repetitions I will still accept the answer if an answer with 1 repetition is not provided)