Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

docopt

Name: Anonymous 2012-10-07 5:06

http://www.youtube.com/watch?v=pXhcPJK5cMc
https://github.com/docopt/docopt

Cool FIOC shit. Generates command line option parser form a documentation text, like this one:


"""Usage: my_program.py [-hso FILE] [--quiet | --verbose] [INPUT ...]

    -h --help    show this
    -s --sorted  sorted output
    -o FILE      specify output file [default: ./test.txt]
    --quiet      print less text
    --verbose    print more text
"""

Name: Anonymous 2012-10-07 5:11

The standard module argparse already does that.

http://docs.python.org/dev/library/argparse.html

Name: Anonymous 2012-10-07 9:49

>>2
I think you don't understand.

It's the other way around, you write

Usage: reddit.py [-abc] [FILE]

Then call docopt and it does everything for you, without adding

argparse.parse.parser.parse(Parse("--parse, parse"))

manually

Name: Anonymous 2012-10-07 10:11

Great. Too bad Python is bad and I'll never use this

Name: Anonymous 2012-10-07 16:16

So parsing arguments is hard? Oh right, shitty languages don't have pointers.

Name: Anonymous 2012-10-08 5:34

This is worse than getopt/argparse because the former was marked obsolete in 2.6 or 2.7 and is to be phased out while argparse is not available in 2.6 stdlib.  So you kinda already have to check for both and use the available one, or parse arguments manually (like I do because it's trivial in Python).

This only adds another package dependency.

Don't change these.
Name: Email:
Entire Thread Thread List