[issue19462] Add remove_argument() method to argparse.ArgumentParser
paul j3
report at bugs.python.org
Fri Nov 1 17:29:38 CET 2013
paul j3 added the comment:
Just hang on the Action object that the `add_argument` returned, and change its `help` attribute.
a = parser.add_argument('--foo', help='initial help')
....
a.help = 'new help'
If using a custom parser class and subclass, I'd do something like:
self.changeablearg = self.parser.add_argument...
in the class, and
self.changeablearg.help = 'new help'
in the subclass
You can test the help message with
print parser.format_help()
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19462>
_______________________________________
More information about the Python-bugs-list
mailing list