optparse variable parsing?

benjamin schollnick bscholln at mac.com
Tue Mar 9 19:49:18 EST 2004


In article <mailman.175.1078843363.19534.python-list at python.org>, CJ
Kucera <python at apocalyptech.com> wrote:

>> > I would suggest that you should have two different options here, a
> > simple switch and an option which expects/requires an argument.
> > That's easier to document as well.
> 
> Yeah, that's what I've been doing, it's just a bit tight because
> right now the program already accepts fourteen options, and finding
> options that make sense while keeping them down to one-letter
> arguments (don't like having to have more than one letter per arg)
> can get a bit challenging.  :)
> 
> Well, thanks for the confirmation!

Sorry for butting in here....

But 14 options?  Is there not a way you can simplify this instead?

Would this program be better suited being split into 2 seperate
programs?  Or rethinking the command line options?

Of course, I have no details on the program, how it's used, and
what you are sending to it....

But if some of the data is *RARELY changed*, why not make a INI file,
and load the data from configparser?

For example:

> For example, let's say that I'm writing a util to add a user to some
> system.  By default, the program would assign a random password:

Items that might not change:

1) The root Home directory
2) Password Generation method
3) Default Permissions
?????

I've run out of ideas....

But if the command line is running low on space, turn the idea 90
degrees, and declare it imaginary....

         - Benjamin



More information about the Python-list mailing list