title: Python - Circumvent argparse nargs error
body: <p>I have a program that works like this:</p>
  
  <pre><code>prog.py filename -r
  </code></pre>
  
  <p>Uses default default values given by me</p>
  
  <pre><code>prog.py filename -r 0 500 20
  </code></pre>
  
  <p>Uses <code>0, 500 and 20</code></p>
  
  <p>I've managed to achieve this using:</p>
  
  <pre><code>class RdistAction(argparse.Action):
      def __call__(self,parser,namespace,values,option_string=None):
          if not values:
              setattr(namespace,self.dest,[0, 1000, 50])
          else:
              setattr(namespace,self.dest,values)
  
  parser = argparse.ArgumentParser()
  parser.add_argument("-r", "--rdist", action=RdistAction, nargs='*', type=int)
  args = parser.parse_args()
  </code></pre>
  
  <p>But I want to be stubborn, as my original goal was to have nargs set to 3. But when I use nargs=3 in the above code, I get an error message stating that 3 arguments were expected.</p>
  
  <p>I've googled around, and from the results my gut tells me that I have to add <code>def __init__</code> and modify something in that function. Is it possible to get the same results I get in the above code when <code>nargs='*'</code>, but with <code>nargs=3</code> instead?</p>