Ten Essential Development Practices

Michael Hoffman cam.ac.uk at mh391.invalid
Fri Jul 29 13:44:37 EDT 2005


Jorge Godoy wrote:
> Michael Hoffman wrote:
> 
> 
>>He spends so much space on "Create Consistent Command-Line Interfaces,"
>>a section that, in Python, could be replaced with a simple "Use optparse."
> 
> 
> In Perl there's also the equivalent of optparse, but where does it guarantee
> that you'll use consistent name options and design a good interface?  I
> think he's point is much broader than parsing input from the command line.

True, but a lot of his point *is* parsing input from the command line. 
Consider the following points paraphrased from his article:

* Don't mix multiple ways of specifying options. (Solved by optparse)
* If a flag expects an associated value, allow an optional = between the 
flag and the value. (Solved by optparse)
* Allow single-letter options to be "bundled" after a single dash. 
(Solved by optparse)
* Always allow -- as a file list marker. (Solved by optparse)

And a lot of the other points are things that are made much, much, 
simpler by optparse, to the point that they become somewhat obvious.
-- 
Michael Hoffman



More information about the Python-list mailing list