This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: optparse documentation: variable arguments example doesn't work as listed
Type: behavior Stage:
Components: Demos and Tools, Documentation Versions: Python 2.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: georg.brandl Nosy List: akuchling, georg.brandl, meyerowitz
Priority: normal Keywords:

Created on 2008-06-05 03:14 by meyerowitz, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg67709 - (view) Author: Trevor Meyerowitz (meyerowitz) Date: 2008-06-05 03:14
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)
msg72666 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2008-09-06 13:04
Fixed in rev. 66250 of trunk; thanks!
History
Date User Action Args
2022-04-11 14:56:35adminsetgithub: 47290
2008-09-06 13:04:25akuchlingsetstatus: open -> closed
nosy: + akuchling
resolution: fixed
messages: + msg72666
2008-06-05 03:14:38meyerowitzcreate