Andrew McNabb <amcn...@mcnabbs.org> 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 <rep...@bugs.python.org>
<http://bugs.python.org/issue5088>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to