Perceived optparse shortcomings

Skip Montanaro skip at pobox.com
Wed Mar 17 10:36:24 EST 2004


    >> <cmd> <generic options> <subcmd> <subcmd options> <args>

    Heather> How about having your plugins "register" with your main program
    Heather> *before* you call optparse? ....

    Heather> I've not used optparse, but I've used that scheme with getopt.

I was thinking that with getopt I would call it once to process the generic
options.  That would leave the args as the list equivalent of

    <subcmd> <subcmd options> <args>

The main program plucks <subcmd> from that list and then passes the
remaining args to the appropriate subcommand, which calls getopt again with
the list equivalent of

    <subcmd options> <args>

I don't know if that's possible with optparse, but if so, that's the route
I'd try first.

Skip




More information about the Python-list mailing list