[New-bugs-announce] [issue3040] optparse documentation: variable arguments example doesn't work as listed

Trevor Meyerowitz report at bugs.python.org
Thu Jun 5 05:14:39 CEST 2008


New submission from Trevor Meyerowitz <trevor.meyerowitz at sun.com>:

There are two minor bugs in the example in:
http://docs.python.org/lib/optparse-callback-example-6.html

For the optparse example documentation, the call to parser.add_option is
listed as:

parser.add_option("-c", "--callback",
                  action="callback", callback=varargs)

this has two bugs:
  1. It refers to the wrong function name
  2. It needs to have a dest variable defined, b/c the callback function
operates on that.

This can be fixed if the parser.add_option call is changed to:
parser.add_option("-c", "--callback",
      action="callback", dest="foo", callback=varargs_callback)

----------
assignee: georg.brandl
components: Demos and Tools, Documentation
messages: 67709
nosy: georg.brandl, meyerowitz
severity: normal
status: open
title: optparse documentation: variable arguments example doesn't work as listed
type: behavior
versions: Python 2.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3040>
_______________________________________


More information about the New-bugs-announce mailing list