title: In Python, using argparse, allow only positive integers
body: <p>The title pretty much summarizes what I'd like to have happen.</p>
  
  <p>Here is what I have, and while the program doesn't blow up on a nonpositive integer, I want the user to be informed that a nonpositive integer is basically nonsense.</p>
  
  <pre><code>import argparse
  parser = argparse.ArgumentParser()
  parser.add_argument("-g", "--games", type=int, default=162,
                      help="The number of games to simulate")
  args = parser.parse_args()
  </code></pre>
  
  <p>And the output:</p>
  
  <pre><code>python simulate_many.py -g 20
  Setting up...
  Playing games...
  ....................
  </code></pre>
  
  <p>Output with a negative:</p>
  
  <pre><code>python simulate_many.py -g -2
  Setting up...
  Playing games...
  </code></pre>
  
  <p>Now, obviously I could just add an if to determine <code>if args.games</code> is negative, but I was curious if there was a way to trap it at the <code>argparse</code> level, so as to take advantage of the automatic usage printing.</p>
  
  <p>Ideally, it would print something similar to this:</p>
  
  <pre><code>python simulate_many.py -g a
  usage: simulate_many.py [-h] [-g GAMES] [-d] [-l LEAGUE]
  simulate_many.py: error: argument -g/--games: invalid int value: 'a'
  </code></pre>
  
  <p>Like so:</p>
  
  <pre><code>python simulate_many.py -g -2
  usage: simulate_many.py [-h] [-g GAMES] [-d] [-l LEAGUE]
  simulate_many.py: error: argument -g/--games: invalid positive int value: '-2'
  </code></pre>
  
  <p>For now I'm doing this, and I guess I'm happy:</p>
  
  <pre><code>if args.games &lt;= 0:
      parser.print_help()
      print "-g/--games: must be positive."
      sys.exit(1)
  </code></pre>