[Python-Dev] Hotshot (original) (raw)

Barry Warsaw barry at python.org
Mon Jan 26 11:36:48 EST 2004


On Mon, 2004-01-26 at 10:40, Guido van Rossum wrote:

> Walter> Maybe this script should use optparse instead of getopt? > > How would optparse be better than getopt, especially for simple use > such as this?

Optparse is always better than getopt, once you're used to it. Even for a single option it's usually fewer lines of code.

And with Optparse it's much easier to add/remove options since each option's spec and handling is in one place, instead of spread out in several places. I do have a few minor nits with optparse though[1]. Even so, +1 on using Optparse for all new scripts.

-Barry

[1] e.g http://sourceforge.net/tracker/?group_id=5470&atid=105470&func=detail&aid=842213



More information about the Python-Dev mailing list