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: Documentation for re.compile is a bit outdated
Type: enhancement Stage: resolved
Components: Documentation, Regular Expressions Versions: Python 3.7, Python 3.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: Elena.Oat, Mariatta, Sworddragon, SylvainDe, cryvate, docs@python, emilyemorehouse, ezio.melotti, matrixise, mrabarnett, rhettinger, swapnil agarwal
Priority: normal Keywords: easy, patch

Created on 2016-03-28 15:21 by Sworddragon, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue26656.diff Elena.Oat, 2017-08-26 18:58
Pull Requests
URL Status Linked Edit
PR 3211 merged python-dev, 2017-08-26 13:17
PR 3225 merged Mariatta, 2017-08-28 05:43
PR 3218 closed python-dev, 2017-08-28 05:53
Messages (15)
msg262571 - (view) Author: (Sworddragon) Date: 2016-03-28 15:21
The documentation for re.compile says "Compile a regular expression pattern into a regular expression object, which can be used for matching using its match() and search() methods, described below." which implies that match() and search() are the only methods for it while there are a few more. Maybe this sentence should be worded more generic or at least complete the list.
msg279259 - (view) Author: Stéphane Wirtel (matrixise) * (Python committer) Date: 2016-10-23 13:05
What do you propose for the doc of re.compile ?
msg279273 - (view) Author: (Sworddragon) Date: 2016-10-23 18:40
The proposal is in the startpost.
msg279285 - (view) Author: Matthew Barnett (mrabarnett) * (Python triager) Date: 2016-10-23 20:28
@Sworddragon: Your post says that it should be more generic or complete the list, but it doesn't make a suggestion as to what it should _actually_ say.

Example: "Compile a regular expression pattern into a regular expression object, which can be used for matching and replacing using the methods described below."
msg295130 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2017-06-04 16:37
FWIW, I think the sentence is fine as-is.  The "which can be used" part doesn't purport to be all inclusive.   I rather like that at match() and search() are mentioned -- this is better than more vague reference to "the methods described below" -- and this is better than listing out every method.

I vote for leaving this alone.
msg295724 - (view) Author: SylvainDe (SylvainDe) * Date: 2017-06-11 17:59
IMHO, the sentence is not bad as it is. An easy (?) yet efficient way to make it much better from the a user perspective would be to make the "regular expression object" text a link leading to https://docs.python.org/3/library/re.html#regular-expression-objects .
msg295840 - (view) Author: Emily Morehouse (emilyemorehouse) * (Python committer) Date: 2017-06-13 03:03
YAHO (yet another humble opinion), I support improving the current re.compile documentation by adding a link to the regular expression object documentation. Great way to point a user to the complete list of methods and attributes while keeping match() and search() listed explicitly.
msg296317 - (view) Author: swapnil agarwal (swapnil agarwal) Date: 2017-06-19 11:55
hello team,

I am novice developer. Can I take it up as my first bug.
msg299972 - (view) Author: SylvainDe (SylvainDe) * Date: 2017-08-09 06:52
@swapnil agarwal I think you can go for it.
msg300895 - (view) Author: Elena Oat (Elena.Oat) * Date: 2017-08-26 18:58
Added the link to the regular expression objects.
msg300898 - (view) Author: Emily Morehouse (emilyemorehouse) * (Python committer) Date: 2017-08-26 19:20
PR 3211 - LGTM, but is not CLA signed.

Elena, a couple of notes on your patch. Using :ref:`regular expression object <re-objects>` to link to the section of the documentation is preferred, as it does not rely on a consistent URL. Also, be mindful of line lengths, feel free to break lines to avoid this. If you would like to submit a PR on Github for these changes, it can more easily be merged in. (Check https://docs.python.org/devguide/pullrequest.html for more info).
msg300932 - (view) Author: Henk-Jaap Wagenaar (cryvate) * Date: 2017-08-27 23:14
Emily: I've signed the CLA, just waiting for it to be checked.
msg300937 - (view) Author: Mariatta (Mariatta) * (Python committer) Date: 2017-08-28 05:41
New changeset ed94a8b2851914bcda3a77b28b25517b8baa91e6 by Mariatta (Henk-Jaap Wagenaar) in branch 'master':
bpo-26656: Improve re.compile documentation (GH-3211)
https://github.com/python/cpython/commit/ed94a8b2851914bcda3a77b28b25517b8baa91e6
msg300938 - (view) Author: Mariatta (Mariatta) * (Python committer) Date: 2017-08-28 05:50
New changeset 83e5c888fff2bf3663952b2bfd3a3ee6c20386ef by Mariatta in branch '3.6':
[3.6] bpo-26656: Improve re.compile documentation (GH-3211) (GH-3225)
https://github.com/python/cpython/commit/83e5c888fff2bf3663952b2bfd3a3ee6c20386ef
msg300939 - (view) Author: Mariatta (Mariatta) * (Python committer) Date: 2017-08-28 05:52
There are two PRs for this issue. 
I accepted the earlier one, and it's been backported to 3.6.

Thanks everyone.
History
Date User Action Args
2022-04-11 14:58:29adminsetgithub: 70843
2017-08-28 05:53:50python-devsetpull_requests: + pull_request3268
2017-08-28 05:52:11Mariattasetstatus: open -> closed
versions: - Python 3.5
messages: + msg300939

resolution: fixed
stage: resolved
2017-08-28 05:50:10Mariattasetmessages: + msg300938
2017-08-28 05:43:38Mariattasetpull_requests: + pull_request3267
2017-08-28 05:41:22Mariattasetnosy: + Mariatta
messages: + msg300937
2017-08-27 23:14:04cryvatesetnosy: + cryvate
messages: + msg300932
2017-08-26 19:20:56emilyemorehousesetmessages: + msg300898
2017-08-26 18:58:40Elena.Oatsetfiles: + issue26656.diff

nosy: + Elena.Oat
messages: + msg300895

keywords: + patch
2017-08-26 13:17:50python-devsetpull_requests: + pull_request3249
2017-08-09 06:52:09SylvainDesetmessages: + msg299972
2017-06-19 11:55:14swapnil agarwalsetnosy: + swapnil agarwal
messages: + msg296317
2017-06-13 03:03:38emilyemorehousesetnosy: + emilyemorehouse
messages: + msg295840
2017-06-11 17:59:05SylvainDesetnosy: + SylvainDe
messages: + msg295724
2017-06-04 16:37:25rhettingersetstatus: pending -> open
nosy: + rhettinger
messages: + msg295130

2017-06-04 15:50:29serhiy.storchakasetkeywords: + easy
status: open -> pending
2016-10-23 20:28:22mrabarnettsetmessages: + msg279285
2016-10-23 18:40:50Sworddragonsetmessages: + msg279273
2016-10-23 13:05:39matrixisesetnosy: + matrixise
messages: + msg279259
2016-10-16 22:30:20serhiy.storchakasetnosy: + ezio.melotti, mrabarnett

type: behavior -> enhancement
components: + Regular Expressions
versions: + Python 3.6, Python 3.7
2016-03-28 15:21:24Sworddragoncreate