[docs] Small mistake in documentation

Terence Lewis terencelz90 at gmail.com
Wed May 15 03:55:42 CEST 2013


Hi,

I was reading through the tutorial of Argparse module and found a small
mistake.

http://docs.python.org/2/howto/argparse.html#getting-a-little-more-advanced

Notice that so far we’ve been using verbosity level to *change* the text
that gets displayed. The following example instead uses verbosity level to
display *more* text instead:

import argparseparser =
argparse.ArgumentParser()parser.add_argument("x", type=int, help="the
base")parser.add_argument("y", type=int, help="the
exponent")parser.add_argument("-v", "--verbosity", action="count",
default=0)args = parser.parse_args()answer = args.x**args.yif
args.verbosity >= 2:
    print "Running '{}'".format(__file__)if args.verbosity >= 1:
    print "{}^{} ==".format(args.x, args.y),print answer

The second last line should be


    print "{}^{} == {}".format(args.x, args.y, answer)

as stated in other similar paragraphs.

Terence
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/docs/attachments/20130515/33ad9291/attachment.html>


More information about the docs mailing list