Saturday, February 20, 2010

Command Line Arguments

I've switched to argparse, an awesome replacement for optparse, the standard Python library for parsing command line arguments. Here is a feature comparison.

Subcommand support was the feature that sold me on argparse. It is now common practice to break a complex command line utility into subcommands that are invoked by the first positional argument. argparse handles this out of the box and even provides a way to store a function name, so you don't even have to figure out which subcommand was invoked.

No comments:

Post a Comment