Well, I don't know what is wrong with people then. I don't see how required arguments are of bad design. Some command-line applications are built around performing tasks based on information received. Compilers, for example. A compiler can't do much of anything unless you give it at the very least a filename. So, a --file command would most definitely be one required argument. Anyway, I'm not trying to start a debate on this issue. I have my own implementation for required arguments at the moment, I am just a little bit surprised that this module doesn't make it convenient. It would definitely help on code duplication.
<br><br>Thanks for your response.<br><br><div><span class="gmail_quote">On 8/20/07, <b class="gmail_sendername">Jay Loden</b> <<a href="mailto:python@jayloden.com">python@jayloden.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Robert Dailey wrote:<br>> Hi,<br>><br>> I've been reading through the python documentation on the optparse<br>> module and I was unable to find out how to specify if an option is<br>> optional or required. The documentation vaguely states that actions can
<br>> be used to do this, however I was not able to figure out how. If anyone<br>> could help I'd greatly appreciate it.<br>><br><br>According to the optparse docs:<br><br>required option<br>    an option that must be supplied on the command-line; note that the
<br>    phrase ``required option'' is self-contradictory in English. optparse<br>    doesn't prevent you from implementing required options, but doesn't<br>    give you much help at it either. See examples/required_1.py and
<br>    examples/required_2.py in the optparse source distribution for two<br>    ways to implement required options with optparse.<br><br><br>And from what I can see, this seems to be somewhat intentional, see <a href="http://wiki.python.org/moin/OptParse">
http://wiki.python.org/moin/OptParse</a> the note at the bottom with a link to a mailing list thread. As far as I can tell, evidently some people feel that required options are indicative of a bad design and therefore optparse was designed not to make this easy on the programmer.
<br><br>-Jay<br></blockquote></div><br>