title: argparse optional argument before positional argument
body: <p>I was wondering if it is possible to have a positional argument follow an argument with an optional parameter. Ideally the last argument entered into the command line would always apply toward 'testname'.</p>
  
  <pre><code>import argparse
  parser = argparse.ArgumentParser(description='TAF')
  parser.add_argument('-r','--release',nargs='?',dest='release',default='trunk')
  parser.add_argument('testname',nargs='+')
  args = parser.parse_args()
  </code></pre>
  
  <p>I would like both of these calls to have smoketest apply to testname, but the second one results in an error.</p>
  
  <pre><code>&gt;&gt; python TAF.py -r 1.0 smoketest
  &gt;&gt; python TAF.py -r smoketest
  TAF.py: error: too few arguments
  </code></pre>
  
  <p>I realize that moving the positional argument to the front would result in the correct behavior of the optional parameter, however this is not quite the format I am looking for. The choices flag looks like an attractive alternative, however it throws an error instead of ignoring the unmatched item.</p>
  
  <p>EDIT:
  I've found a hacky way around this. If anyone has a nicer solution I would appreciate it.</p>
  
  <pre><code>import argparse
  parser = argparse.ArgumentParser(description='TAF')
  parser.add_argument('-r','--release',nargs='?',dest='release',default='trunk')
  parser.add_argument('testname',nargs=argparse.REMAINDER)
  args = parser.parse_args()
  
  if not args.testname:
      args.testname = args.release
      args.release = ''
  </code></pre>