[issue6538] MatchObject is not a hyperlink in the 're' module documentation
Terry J. Reedy
report at bugs.python.org
Thu Jul 29 01:41:25 CEST 2010
Terry J. Reedy <tjreedy at udel.edu> added the comment:
I believe these patches are wrong, at least in part, and should be reverted.
1.The re module no longer has either a class RegexObject or a class MatchObject. (They are now _sre.SRE_Pattern and _sre.SRE_Match.) So
the previous reference to them as anonymous "Compiled regular expression objects" and "Match objects" (lower case 'objects') was correct, certainly more correct that marking the fake names as real code. In other words. 'MatchObject' should be removed, not hyperlinked.
This issue came up today on python-list when someone tried "help(re.MatchObject)" and got a module attribute error. I was about to open a new issue when I discovered this one. I recommend changing the re.match entry from "return a corresponding MatchObject instance." to "return a match object" (which is what the current doc string says) and removing all the misleading RegexObject and MatchObject fake-class method prefixes, The prefixes are present in 2.6 and already removed in 2.7. I think they should also be removed from the 3.x docs. (Unless, of course, re is changed to add/reinstate those names, which could only happen in 3.2.)
2. I believe it is the policy that the 3.x docs 'start fresh' with 3.0. Ancient back-compatibility notes like
"(Incompatibility note: in the original Python 1.5 release, if the tuple was one element long, a string would be returned instead. In later versions (from 1.5.1 on), a singleton tuple is returned in such cases.)"
were intentionally, not accidentally, removed in 3.0. So I think it a mistake to put revert the removal and that the reversion should be reverted.
3. This is more of a question. I have noticed that optional parameters with defaults are sometimes bracketed and sometimes not. Since the brackets are redundant, I prefer without as less cluttered and so I question the addition in the 3.2 patch. But is there a definitive current doc style guide? In any case, removing the default value while changing 'group=0' to '[group]' seems wrong.
assignee: brian.curtin -> christian.heimes
nosy: +christian.heimes, tjreedy
resolution: fixed ->
status: closed -> open
Python tracker <report at bugs.python.org>
More information about the Python-bugs-list