title: mixing positional and optional arguments in argparse
body: <p>I am facing a problem in <code>argparse</code> when I mix positional arguments , optional arguments and <code>argparse.REMAINDER</code></p>
  <pre><code>parser = argparse.ArgumentParser()
  parser.add_argument('verbose', action=&quot;store&quot;)
  parser.add_argument('--config', '-c', nargs=&quot;?&quot;, dest=&quot;config_file&quot;)
  parser.add_argument('--dry-run', action=&quot;store_true&quot;, dest=&quot;dryrun&quot;)
  parser.add_argument('args', nargs=argparse.REMAINDER, action=&quot;store&quot;)
  </code></pre>
  <p>Sample run:</p>
  <pre><code>python test.py verbose=&quot;5&quot; --config config.xml graph --dry-run
  </code></pre>
  <p>Expected output:</p>
  <pre><code>verbose = &quot;5&quot;
  config_file = config.xml
  dryrun = True
  args = ['graph']
  </code></pre>
  <p>Actual output:</p>
  <pre><code>verbose = &quot;5&quot;
  config_file = config.xml
  dryrun = False
  args = ['graph', '--dry-run']
  </code></pre>
  <p>My requirement is I have <code>verbose</code>, <code>-c</code>, <code>--config</code> and <code>--dry-run</code> as command line options and any other options provided at command line should be stored in the list <code>args</code> irrespective of the order of appearance of arguments at command line.
  Please help where I am doing wrong.
  Also is there any other better command line parser for python?</p>