optparse - required options

Jay Loden python at jayloden.com
Mon Aug 20 17:31:00 EDT 2007


Robert Dailey wrote:
> 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.
> 
> Thanks for your response.

I tend to agree...while "required option" may be an oxymoron in English, I can think of quite a few scripts I've written myself (in various languages) that needed at least some kind of user input to operate. At least the documentation points to some examples for helpful hints, example code is a lot better than nothing ;)

-Jay



More information about the Python-list mailing list