+1 docopt is the killer module "de facto" for command line programs. 2013/10/21 anatoly techtonik <techtonik@gmail.com>
On Sat, Sep 28, 2013 at 1:42 PM, Ned Batchelder <ned@nedbatchelder.com> wrote:
On 9/28/13 12:44 AM, anatoly techtonik wrote:
This - http://docopt.org/ - should be included with Python 3.4 distribution.
In addition to the other questions already asked, you haven't answered
fundamental one: Why should docopt be included in the stdlib?
Because it is the easiest and most intuitive way to quickly build command line parser with a less amount of writing. It also provides synced help, custom formatting, really short parser definition syntax and subcommands out of the box.
But the main reason that it is a 'fastest way ever to expose script functions to command line user interface'. Writing it is as fast as 10x times on average compared to argparse, optparse and getopt interfaces. 50 minutes on argparse with debug and 5 on docopt. 5 minutes regardless of your experience. For a newbie getting what argparse does may take more that 50 minutes on average, and it is still probably the same 5 minutes for docopt.
It's right there in PyPI where any one can get it. Why is it better in the stdlib
On Mon, Oct 21, 2013 at 7:39 AM, anatoly techtonik <techtonik@gmail.com> wrote: the than
in PyPI?
Because you need a Python on your machine. Language with batteries included. Not a C or Java where probably need to download libraries even to work with strings. Setting docopt on every machine where you need to quickly give some variations for execution flow to your one-time command line script is akin to launching the C compiler with appropriate include paths.
Also, the command line interface definition (help on script abilities) in docopt can be easily read by any human without the need to run the script or decipher argparse/optparge function call parameters. -- anatoly t. _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas
-- Carlo Pires