2 ms·
> I think argparse is a cool module, and definitely better than optparse or getopt for the types of things I do. Have you tried docopt? https://github.com/doco
by toyg 13y ago
> I think argparse is a cool module, and definitely better than optparse or getopt for the types of things I do.
Have you tried docopt? https://github.com/docopt/docopt https://github.com/docopt/docopt
- dalke 13y agoNo. I looked at it once though. I might try it in the future, but I don't think useful to change my current system. I have internal type strings which look like this "RDKit minPath=3 maxPath=7" and command-line options like "--minPath=3 --maxPath=7". I ended up making a registry of options which is used to validate the type strings and is used to populate argparse. I also use custom decoders, like a decoder to enforce that a given value is >=32 and a power of two. A quick glimpse at the docs doesn't show a way to support that ability, so it would need to be rewritten to occur after arg parsing has finished rather than during. I don't doubt that I could use docopt instead, but the amount of work to migrate doesn't seem worthwhile.