New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docstring of optparse.OptionParser incomplete #52405
Comments
The class optparse.OptionParser supports a number of useful keyword arguments to the initializer, which are not documented in the Python Standard Library documentation, here: http://docs.python.org/library/optparse.html This is a bit unfortunate. For example, I wanted to add a description to the top of my script's help page and a copyright notice to the foot, and was already about to subclass OptionParser in order to override the format_help method, when I noticed that optional keyword arguments 'description' and 'epilog' are provided for precisely this purpose. The 'epilog' attribute is at least mentioned in the class's docstring, while the 'description' argument is completely undocumented. I doubt that this was done on purpose. I'd suggest to go over the documentation page for optparse and fill in the missing bits; at minimum, list all keyword arguments to optparse.OptionParser.__init__. |
Would you care to submit a patch? The docs are in the svn repository in the 'Doc' subdirectory. See http://www.python.org/dev for how to get a checkout and create a patch. That said, note that 2.7/3.2 will have argparse, which is pretty much a superset of optparse and recommended for use instead of optparse, and it does document those options. |
Senthil documented epilog in bpo-8209. |
Hello, Regards, |
Sorry, I probably overlooked at the situation. After a quick chat with Antoine on IRC, it's clear optparse is here to stay for all the lifetime of 2.7 (quite a long and prosper, we hope :) so yes, it's worth work on its documentation, hence I'll start preparing a patch and I'll submit it asap. Cheers, |
I've read through the doc and the code. All keyword arguments for OptionParser.__init__() are in the documentation for branches 2.7 and default (as of ecc176488349). Does that mean this issue can be closed? |
It looks to me like description is still missing from the docstring, at least on python3 tip. |
You are correct. I have added 'description' to the docstring of the OptionParser class for 2.7 and default (python3 tip). Here is the patch for python3 tip. |
Attaching the same patch for 2.7. |
Applied patch cleanly. Also the description reads clearly and makes sense. |
New changeset c13d2552eb51 by R David Murray in branch '2.7': New changeset f559b88bcaa0 by R David Murray in branch '3.1': New changeset b4b0a1458638 by R David Murray in branch '3.2': New changeset 2a403afc4a76 by R David Murray in branch 'default': |
Thanks everyone. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: