Andrew McNabb <[email protected]> added the comment:
I think that optparse is doing the right thing here. I think that your code
example should be changed to:
import optparse
parser = optparse.OptionParser()
parser.add_option("-o", "--option", action = "append")
options, args = parser.parse_args()
if not options.option:
options.option = ['a']
print options
Think of the default as the initial list, and each time the -o option is
specified, an item is appended to that initial list.
----------
nosy: +amcnabb
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue5088>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com