title: Python argparse , add_argument, type = <some function> rather than int?
body: <p>In a project I see the following use of <code>add_argument()</code>:</p>
  
  <pre><code>parser = argparse.ArgumentParser()
  parser.add_argument("--somearg",type=make_arg_instance,help='blahblahblah')
  args = parser.parse_args()
  i = args.somearg.somefunction()
  </code></pre>
  
  <p>in which <code>make_arg_instance</code>is a function defined as:</p>
  
  <pre><code>def make_arg_instance():
      somearg = SomeClassName()
      return somearg
  </code></pre>
  
  <p>It seems the argument 'somearg' is an <code>class</code> object instead of <code>int</code> and that's why later a method is called as in <code>i = args.somearg.somefunction()</code>.</p>
  
  <p>In most tutorials that I've seen the type of argument is always <code>int</code> therefore could someone explain a bit about how to add argument of type <code>class</code> or any type other than <code>int</code>? Thanks!</p>