title: How do I create a Python namespace (argparse.parse_args value)?
body: <p>To interactively test my python script, I would like to create a <code>Namespace</code> object, similar to what would be returned by <code>argparse.parse_args()</code>.
  The obvious way,</p>
  
  <pre><code>&gt;&gt;&gt; import argparse
  &gt;&gt;&gt; parser = argparse.ArgumentParser()
  &gt;&gt;&gt; parser.parse_args()
  Namespace()
  &gt;&gt;&gt; parser.parse_args("-a")
  usage: [-h]
  : error: unrecognized arguments: - a
  
  Process Python exited abnormally with code 2
  </code></pre>
  
  <p>may result in Python repl exiting (as above) on a silly error.</p>
  
  <p>So, <strong>what is the easiest way to create a Python namespace with a given set of attributes?</strong></p>
  
  <p>E.g., I can create a <code>dict</code> on the fly (<code>dict([("a",1),("b","c")])</code>) but I cannot use it as a <code>Namespace</code>:</p>
  
  <pre><code>AttributeError: 'dict' object has no attribute 'a'
  </code></pre>