Best Practices for Python Script Development?

Robert Kern robert.kern at gmail.com
Thu Aug 24 22:31:12 EDT 2006


metaperl wrote:

> Usage
> =====
> Most scripts will be run from cron and so should be driveable via
> command-line options.
> 
> optparse looks very good to me. And I had never thought about
> required versus optional arguments in the way that it does. What an
> eye-opener.
> 
> Searching cheeseshop.python.org/pypi for getopt modules does not work
> very well by the way.

"Does not work very well" how? Are you just not finding anything?

If so, it's probably because there really aren't any, and they wouldn't be 
referred to as "getopt modules." There's the (old) getopt module and the 
(preferred) optparse module in the standard library. optparse really does fill 
the niche quite thoroughly.

However, if you like, there's the newcomer argparse that tries to improve upon 
optparse in several respects:

   http://argparse.python-hosting.com/

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco




More information about the Python-list mailing list