[Tutor] Tutor-level docs: Some gushing on optparse

Scot W. Stevenson scot at possum.in-berlin.de
Sat Aug 23 14:13:33 EDT 2003


Hi there, 

I would like to take a moment to gush  about some Python documentation that 
is so good that it is actually a sort of mini-tutorial in itself. If you are 
not in a mood to be gushed at on Saturday morning, you might want to skip 
this =8). 

Python 2.3 has a new module named "optparse" that handles command line 
options, and handles them so well that it is almost obscene: You find 
yourself inserting options all over the place because it is so easy. Well 
yes, you say -- easy to use, elegant setup, powerful, all very nice, but 
this is Python, after all, so /everything/ is friendly and cheerful and 
filled with chirping birds and pretty flowers and warm sunshine [except of 
course for lambda, which is evil incarnate], so what is so special about 
optparse?

The documentation (http://www.python.org/doc/2.3/lib/module-optparse.html). 
It is actually almost more like a thesis. It starts out with a "Philosophy" 
section that explains command line options, good design (including some 
points on "required options" that I hadn't thought about before), and then 
goes on thru basic to advanced usage to extending the module. At the end, I 
not only felt I knew how to use optparse (and had lots of good examples to 
steal), but that I had learned more about options in Linux/Unix in general.

Beautiful work. If you have a program that uses a lot of options, upgrading 
to 2.3 might be worth your while just for optparse alone.

Y, Scot

-- 
          How to quiet a crying baby with the X Window System: 
                  nice xlock -inwindow -mode kumppa

               Scot W. Stevenson - Zepernick, Germany




More information about the Tutor mailing list