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: sre module has misleading docs
Type: Stage:
Components: Regular Expressions Versions: Python 2.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: georg.brandl Nosy List: effbot, georg.brandl, loewis, tlynn
Priority: normal Keywords:

Created on 2007-01-09 11:12 by tlynn, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
undoc-patch.txt tlynn, 2008-01-25 13:24
Messages (8)
msg30959 - (view) Author: Tom Lynn (tlynn) Date: 2007-01-09 11:12
>>> help(sre)
...
   "$"      Matches the end of the string.
...
   \Z       Matches only at the end of the string.
...
M  MULTILINE   "^" matches the beginning of lines as well as the string.
               "$" matches the end of lines as well as the string.

The docs for "$" are misleading - it actually matches in newline-specific ways which the module's built-in docs don't hint at.  The MULTILINE docs don't clarify this.

I'd also like to see "from sre import __doc__" added to the end of re.py; lack of "help(re)" is a bigger problem than having slightly wrong auto-generated docs for the re module itself.
msg30960 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2007-01-09 18:22
Did you mean to include a patch?
msg30961 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2007-03-06 18:34
Doesn't seem so. Note that the sre.__doc__ problem doesn't exist in 2.5 anymore since re is now what sre was before.
msg30962 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2007-03-06 20:55
The re.__doc__ problem is gone; the problem that the $ documentation doesn't give a complete specification persists.

Fredrik, do you have an opinion on this? If not, please unassign.
msg61424 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008-01-21 17:29
Clarified in r60164.
msg61682 - (view) Author: Tom Lynn (tlynn) Date: 2008-01-25 13:24
Thanks for fixing this. I now also note that (?<=...), (?<!...) and (?
(id/name)yes-pattern|no-pattern) aren't documented, and nor is finditer 
in the main docstring.

The attached patch fixes these, as well as what looks like mistaken 
formatting on one line. Some of the proposed lines are a bit long for 
help(re), but they're hard to shorten.
msg61705 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008-01-26 11:00
Thanks, committed r60136.
msg61720 - (view) Author: Tom Lynn (tlynn) Date: 2008-01-26 20:42
Nice changes to the wording. (For the record: it's r60316 in fact.)
History
Date User Action Args
2022-04-11 14:56:22adminsetgithub: 44435
2008-01-26 20:42:30tlynnsetmessages: + msg61720
2008-01-26 11:00:27georg.brandlsetmessages: + msg61705
2008-01-25 13:24:15tlynnsetfiles: + undoc-patch.txt
messages: + msg61682
2008-01-21 17:29:33georg.brandlsetstatus: open -> closed
assignee: effbot -> georg.brandl
resolution: fixed
messages: + msg61424
2007-01-09 11:12:30tlynncreate