Seems useless at first glance, but may be very helpful when there is a bunch of similar programs which inherit from each other.
E. g.
class Program1:
def __init__(self):
self.argparser = ArgumentParser(...)
self.argparser.add()
...
self.argparser.add() # lots of arguments
def run(self):
args = self.argparser.parse()
# Program workflow
...
class Program2(Program1):
def __init__(self):
super().__init__()
self.argparser.add('additional argument specific to Program2 only')
self.argparser.remove('argument useless in Program2') # <-- method to be added
It would be useful to have official API to do this trick.
Unless / until more people request this, perhaps you can implement it by creating your own subclass of ConfigArgParse (or by accessing internal data structures like self._actions)?
Method to remove argument by name.
Seems useless at first glance, but may be very helpful when there is a bunch of similar programs which inherit from each other. E. g.
It would be useful to have official API to do this trick.