> I would like to have something like > > merged_parser = LoggingParser() + OtherParser() > > Which should create an argument parser with all the options composed. >
I have used parent parsers. http://docs.python.org/py3k/library/argparse.html#parents I think in your case merged_parser would become more of a child, like this: >>> mom_parser = argparse.ArgumentParser(add_help=False) >>> mom_parser.add_argument('--arg1', type=int) >>> dad_parser = argparse.ArgumentParser(add_help=False) >>> dad_parser.add_argument('--arg2', type=int) >>> child_parser = argparse.ArgumentParser(parents=[mom_parser, dad_parser]) -- http://mail.python.org/mailman/listinfo/python-list