It should be possible to parse an option list other than
sys.argv with optik/optparse. optik is such a powerful
tool that it would be a pity, if I could not use it for - for
example - an option list read from a file.
In the current implementation one could move this list
to sys.argv and restore sys.argv after option parsing. But
I think that's not a good design.
I suggest to add an optional parameter "source" to the
parse_args() method with a default value of None, in
which parse_args() uses sys.argv as source. One could
also use sys.argv as the default value for source, but I
am not sure if the calling module would have to import
sys in this case.
Log in to post a comment.