Question: Given an argparse parser instance with some arguments added, is there a way to delete/remove an argument defined for it?
Why: Considering the exemple below:
>>>import argparse
>>>parser = argparse.ArgumentParser()
>>>parser.add_argument('--imagePath', action = "store", default = 'toto')
_StoreAction(option_strings=['--imagePath'], dest='imagePath', nargs=None, const=None, default='toto', type=None, choices=None, help=None, metavar=None)
>>>args = parser.parse_args()
>>>args
Namespace(imagePath='toto')
>>>parser.add_argument('--resultPath', action = "store", default = 'titi')
_StoreAction(option_strings=['--resultPath'], dest='resultPath', nargs=None, const=None, default='titi', type=None, choices=None, help=None, metavar=None)
>>>args = parser.parse_args()
>>>args
Namespace(imagePath='toto', resultPath='titi')
If we will, later in the script, change the value of the args.imagePath?
I does not found a method for change the value, but if I can delete / remove the argument imagePath it could be possible to define again imagePath with a new value !
parse_args
and then change the argument definitions? – Kowtow