Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > merging argparse parsers

Thread Tools

merging argparse parsers

Andrea Crotti
Posts: n/a
I would like to have something like

merged_parser = LoggingParser() + OtherParser()

Which should create an argument parser with all the options composed.

Now for that I think I would need to subclass the argument, and something
fancy with the overloading.
The problem is that apparently there is no Argument class, but add_argument
just change the object internal data structures.

So the only alternative I see now is to do something like:
def add_project_argument(parser):
help='paths of the project to run')

which is not very neat and modifies the object in place.
Any other ideas?
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
When argparse will be in the python standard installation Python 9 01-05-2007 06:21 PM
[ANN] argparse 0.3 - Command-line parsing library Steven Bethard Python 0 12-05-2006 05:36 PM
[ANN] argparse 0.2 - Command-line parsing library Steven Bethard Python 0 10-24-2006 04:13 PM
[ANN] argparse 0.1 - Command-line parsing library Steven Bethard Python 1 10-10-2006 11:06 PM
[ANN] The argparse module Steven Bethard Python 0 08-03-2006 05:41 AM