merging argparse parsers

Discussion in 'Python' started by Andrea Crotti, Dec 16, 2011.

  1. 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):
    parser.add_argument('project_path',
    help='paths of the project to run')

    which is not very neat and modifies the object in place.
    Any other ideas?
     
    Andrea Crotti, Dec 16, 2011
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. dede
    Replies:
    0
    Views:
    418
  2. Marcos

    Locator2 and SAX parsers

    Marcos, Jul 15, 2003, in forum: Java
    Replies:
    0
    Views:
    373
    Marcos
    Jul 15, 2003
  3. Nathaniel Hughes

    Cloning Pull Parsers? Particularly XPP3

    Nathaniel Hughes, Feb 2, 2004, in forum: Java
    Replies:
    0
    Views:
    343
    Nathaniel Hughes
    Feb 2, 2004
  4. Gibakou

    javax.xml.Parsers location

    Gibakou, Aug 16, 2004, in forum: Java
    Replies:
    4
    Views:
    934
    gizzy truong
    Nov 23, 2004
  5. Kevin Flood
    Replies:
    0
    Views:
    1,056
    Kevin Flood
    Sep 8, 2004
Loading...

Share This Page