Ten Essential Development Practices

Jorge Godoy godoy at ieee.org
Fri Jul 29 16:13:26 EDT 2005


Michael Hoffman wrote:

> 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.

Take a look at the Perl module, then.  You'll see that all of these are also
solved there "automagically".  I've stoped coding Perl almost 3 years ago,
and even then I never had to write anything to parse command line input by
hand.

I suggest you take a look at Getopt::Long, at CPAN. 

http://search.cpan.org/~jv/Getopt-Long-2.34/
http://search.cpan.org/src/JV/Getopt-Long-2.34/README


Be seeing you,
-- 
Jorge Godoy      <godoy at ieee.org>




More information about the Python-list mailing list