optparse functionality missing

Mark Wooding mdw at distorted.org.uk
Sat Jun 21 11:02:47 EDT 2008


Jeff Keasler <keasler at llnl.gov> wrote:

> In a scripting environment, I often want to strip some of the command
> line options off the argument list, and then pass the remaining
> options to another module that is deeper in the tool chain.

The difficulty is that you can't do an accurate parse without knowing
which options take arguments.  For example, what are the options here?

  foo -xyzzy -abcdef -ghi -ghi -g -hi

Well, `-z', `-f' and `-g' take arguments; the `-g' argument is
optional.  So the correct options to pass along are

  -x -y -zzy -a -b -c -d -e -f-ghi -ghi -g -h -i

Not so obvious, is it? ;-)

-- [mdw]



More information about the Python-list mailing list