[Python-ideas] Python 3.4 should include docopt as-is

anatoly techtonik techtonik at gmail.com
Mon Oct 21 06:43:42 CEST 2013


On Mon, Oct 21, 2013 at 7:39 AM, anatoly techtonik <techtonik at gmail.com> wrote:
> On Sat, Sep 28, 2013 at 1:42 PM, Ned Batchelder <ned at 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 the
>> 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 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.


More information about the Python-ideas mailing list