[docs] argparse count action missing

Tom Ekberg tekberg at u.washington.edu
Thu May 26 00:04:21 CEST 2011


In the page

  http://docs.python.org/library/argparse.html#action

section 15.4.3.2 lists the actions. I was looking at someone elses code which used action='count' which I couldn't find in the above document. I ended up looking at the code to find out about it (use the source Luke). Please consider adding something like the following to describe this action:

* 'count' - This counts the number of time the argument is present. This is useful for specifying a level of detail. Example usage:

>>> parser = argparse.ArgumentParser()
>>> parser.add_argument('-v', '--verbose', dest='verbosity',
...             action='count', default=0,
...             help="Be more verbose. Specify -vv or -vvv for even more")
>>> parser.parse_args(['-vvvv'])
Namespace(verbosity=4)

Tom Ekberg
Senior Computer Specialist, Lab Medicine
University of Washington Medical Center
1959 NE Pacific St, MS 357110
Seattle WA 98195
phone: (206) 598-8544
email: tekberg at u.washington.edu




More information about the docs mailing list