[Python-Dev] PEP 389: argparse - new command line parsing module (original) (raw)

Steven D'Aprano steve at pearwood.info
Mon Sep 28 16:36:56 CEST 2009


On Mon, 28 Sep 2009 06:59:32 am Steven Bethard wrote:

Why aren't getopt and optparse enough? [snip]

As a newbie, I found optparse intimidating because it provided so many features. I expect argparse will be the same, only more so. (Disclaimer: I haven't used argparse, I'm merely making a prediction based on the available functionality.)

As it turned out, optparse wasn't anywhere near as difficult to use as I expected it to be, but I suggest that newbies will have the same response to argparse as I had to optparse -- "this looks complicated, I'll just roll my own". At least I had the option to use getopt.

Not every module needs to be newbie-friendly, but something as fundamental as argument parsing should at least provide a gentle learning curve.

Currently, getopt more-or-less plays the role of "bare-bones" command line parsing, which I think is important. Assuming argparse is added to the std lib, I'm -0.5 on deprecating getopt, 0 on deprecating optparse.

-- Steven D'Aprano



More information about the Python-Dev mailing list