]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #13605: more meaningful example + fixes
authorSandro Tosi <sandro.tosi@gmail.com>
Thu, 19 Jan 2012 21:23:00 +0000 (22:23 +0100)
committerSandro Tosi <sandro.tosi@gmail.com>
Thu, 19 Jan 2012 21:23:00 +0000 (22:23 +0100)
Doc/library/argparse.rst

index a1ddfc95efff639cf4fe1838aed6b7e7989a555a..4272f16d71a1c20fa5e4f067d9ec09d2393b83aa 100644 (file)
@@ -840,16 +840,16 @@ values are:
      usage: PROG [-h] foo [foo ...]
      PROG: error: too few arguments
 
-* ``argparse.REMAINDER``.  All the remaining command-line arguments
-  are gathered into a lits. This is commonly useful for command line
-  utilities that dispatch to other command line utilities.
+* ``argparse.REMAINDER``.  All the remaining command-line arguments are gathered
+  into a list.  This is commonly useful for command line utilities that dispatch
+  to other command line utilities.
 
      >>> parser = argparse.ArgumentParser(prog='PROG')
      >>> parser.add_argument('--foo')
      >>> parser.add_argument('command')
      >>> parser.add_argument('args', nargs=argparse.REMAINDER)
-     >>> print parser.parse_args('--foo B XX YY ZZ'.split())
-     Namespace(args=['YY', 'ZZ'], command='XX', foo='B')
+     >>> print parser.parse_args('--foo B cmd --arg1 XX ZZ'.split())
+     Namespace(args=['--arg1', 'XX', 'ZZ'], command='cmd', foo='B')
 
 If the ``nargs`` keyword argument is not provided, the number of arguments consumed
 is determined by the action_.  Generally this means a single command-line argument