argparse icon indicating copy to clipboard operation
argparse copied to clipboard

Change of argument

Open bunchgrape opened this issue 3 years ago • 2 comments

How can I declare an argument and then change its value? Like in the Python: parser.arg = value Thx.

bunchgrape avatar May 14 '22 09:05 bunchgrape

Unlike the Python argparser, this argparse does not return a Namespace object from ::parse_args, but stores values in the ArgumentParser instance. This storage is not assignable except through ::parse_args.

A pattern I have used in my own argparse-using projects is to ::get values and assign them to other variables as part of the program setup.

skrobinson avatar May 16 '22 14:05 skrobinson

I see. Thank you so much.

bunchgrape avatar May 17 '22 04:05 bunchgrape