homepage

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: Doc for optparse.OptionParser.get_option_group is wrong
Type: Stage: resolved
Components: Documentation Versions: Python 3.2, Python 3.3, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: adam.woodbeck, aronacher, docs@python, eli.bendersky, eric.araujo, georg.brandl, lunar_yorn, nnorwitz, petri.lehtinen, python-dev, sandro.tosi, weeble
Priority: normal Keywords: easy, needs review, patch

Created on 2011年03月28日 08:43 by weeble, last changed 2022年04月11日 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue11699.patch petri.lehtinen, 2011年07月30日 05:08
Messages (10)
msg132385 - (view) Author: Weeble (weeble) Date: 2011年03月28日 08:43
The docs for optparse say this:
OptionParser.get_option_group(opt_str)
 Return, if defined, the OptionGroup that has the title or the long description equals to opt_str
After failing to get this to work at all, I looked at the implementation, and the documentation is completely wrong. The method takes an option string, like '-o' or '--option' and returns the option group that it belongs to.
Personally, I would much prefer the function to do what the documentation describes, i.e. find the option group with the given name, but I guess it's far too late for that. The scenario I'm in is that I'm writing a plugin for an existing tool which provides access to its OptionParser to add new options, but doesn't provide references to any of the groups that are already created.
It looks like this documentation was added recently:
http://bugs.python.org/issue1665333 
msg141311 - (view) Author: Petri Lehtinen (petri.lehtinen) * (Python committer) Date: 2011年07月28日 18:42
Attached a patch for 2.7.
msg141341 - (view) Author: Eli Bendersky (eli.bendersky) * (Python committer) Date: 2011年07月29日 11:00
Petri,
I think the "to" after "belongs" is redundant.
Also, the issue lists 3.2 and 3.3 - is the fix relevant there too? If yes, can you prepare a patch for 3.2? (I will merge it to 3.3 too)
msg141360 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011年07月29日 12:41
Yep, the "to" is already present before the verb :)
I think we mark None as ``None``, not *None*. (If the rest of the file does otherwise, then do that.)
msg141423 - (view) Author: Petri Lehtinen (petri.lehtinen) * (Python committer) Date: 2011年07月30日 05:08
Updated the patch:
- Removed the extra "to"
- Changed *None* to ``None`` for conformance with the rest of the file
The same patch applies unmodified to 2.7 and 3.2 branches.
msg141424 - (view) Author: Eli Bendersky (eli.bendersky) * (Python committer) Date: 2011年07月30日 05:12
Armin, adding you as the optparse expert - could you see the doc change makes sense?
[I will then do the commit work]
msg141427 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2011年07月30日 07:07
It does make sense, please commit.
msg141431 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011年07月30日 08:14
New changeset 5a248fcfa112 by Eli Bendersky in branch '2.7':
Issue #11699: fix documentation of OptionParser.get_option_group. Patch by Petri Lehtinen
http://hg.python.org/cpython/rev/5a248fcfa112 
msg141433 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011年07月30日 08:39
New changeset cfb60dfa7734 by Eli Bendersky in branch '3.2':
Issue #11699: fix documentation of OptionParser.get_option_group. Patch by Petri Lehtinen
http://hg.python.org/cpython/rev/cfb60dfa7734
New changeset 27b588dd6155 by Eli Bendersky in branch 'default':
Merge 3.2: Issue #11699: fix documentation of OptionParser.get_option_group. Patch by Petri Lehtinen
http://hg.python.org/cpython/rev/27b588dd6155 
msg141434 - (view) Author: Eli Bendersky (eli.bendersky) * (Python committer) Date: 2011年07月30日 08:43
Done. 
Petri - thanks for the contribution.
History
Date User Action Args
2022年04月11日 14:57:15adminsetgithub: 55908
2011年07月30日 13:30:30eric.araujosetstage: patch review -> resolved
2011年07月30日 08:43:31eli.benderskysetstatus: open -> closed
resolution: fixed
messages: + msg141434
2011年07月30日 08:39:44python-devsetmessages: + msg141433
2011年07月30日 08:14:56python-devsetnosy: + python-dev
messages: + msg141431
2011年07月30日 07:07:33georg.brandlsetmessages: + msg141427
2011年07月30日 05:12:41eli.benderskysetnosy: + aronacher
messages: + msg141424
2011年07月30日 05:08:49petri.lehtinensetfiles: - issue11699.patch
2011年07月30日 05:08:37petri.lehtinensetfiles: + issue11699.patch

messages: + msg141423
2011年07月29日 12:41:16eric.araujosetmessages: + msg141360
2011年07月29日 11:00:14eli.benderskysetmessages: + msg141341
2011年07月29日 07:56:04eli.benderskysetnosy: + eli.bendersky
2011年07月28日 18:42:56petri.lehtinensetstage: patch review
2011年07月28日 18:42:37petri.lehtinensetfiles: + issue11699.patch
versions: - Python 3.1
nosy: + petri.lehtinen

messages: + msg141311

keywords: + patch, easy, needs review
2011年05月28日 12:49:13adam.woodbecksetnosy: + adam.woodbeck
2011年04月02日 00:06:28terry.reedysettitle: Documentation for get_option_group is wrong -> Doc for optparse.OptionParser.get_option_group is wrong
2011年03月28日 15:38:06eric.araujosetnosy: + nnorwitz, georg.brandl, lunar_yorn, eric.araujo, docs@python

assignee: docs@python
components: + Documentation
versions: + Python 3.1, Python 2.7, Python 3.2, Python 3.3
2011年03月28日 08:48:40sandro.tosisetnosy: + sandro.tosi
2011年03月28日 08:43:49weeblecreate

AltStyle によって変換されたページ (->オリジナル) /