Consider
import argparse
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument("--foo", type=str, default="bar", help="description")
args = parser.parse_args()
Now I would like to know if args.foo
got its value due to the default, or because the user specified myprogram --foo bar
. How can I distinguish that?
Edit: A big plus would be if the docstring still reflected the default.