[issue26656] Documentation for re.compile is a bit outdated

New submission from Sworddragon: 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. ---------- assignee: docs@python components: Documentation messages: 262571 nosy: Sworddragon, docs@python priority: normal severity: normal status: open title: Documentation for re.compile is a bit outdated type: behavior versions: Python 3.5 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue26656> _______________________________________

Changes by Serhiy Storchaka <storchaka+cpython@gmail.com>: ---------- components: +Regular Expressions nosy: +ezio.melotti, mrabarnett type: behavior -> enhancement versions: +Python 3.6, Python 3.7 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue26656> _______________________________________

Stéphane Wirtel added the comment: What do you propose for the doc of re.compile ? ---------- nosy: +matrixise _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue26656> _______________________________________

Sworddragon added the comment: The proposal is in the startpost. ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue26656> _______________________________________

Matthew Barnett added the comment: @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." ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue26656> _______________________________________

Changes by Serhiy Storchaka <storchaka+cpython@gmail.com>: ---------- keywords: +easy status: open -> pending _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue26656> _______________________________________

Raymond Hettinger added the comment: 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. ---------- nosy: +rhettinger status: pending -> open _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue26656> _______________________________________

SylvainDe added the comment: 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 . ---------- nosy: +SylvainDe _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue26656> _______________________________________

Emily Morehouse added the comment: 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. ---------- nosy: +emilyemorehouse _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue26656> _______________________________________

swapnil agarwal added the comment: hello team, I am novice developer. Can I take it up as my first bug. ---------- nosy: +swapnil agarwal _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue26656> _______________________________________

SylvainDe added the comment: @swapnil agarwal I think you can go for it. ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue26656> _______________________________________

Changes by Roundup Robot <devnull@psf.upfronthosting.co.za>: ---------- pull_requests: +3249 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue26656> _______________________________________

Elena Oat added the comment: Added the link to the regular expression objects. ---------- keywords: +patch nosy: +Elena.Oat Added file: http://bugs.python.org/file47103/issue26656.diff _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue26656> _______________________________________

Emily Morehouse added the comment: 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). ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue26656> _______________________________________

Henk-Jaap Wagenaar added the comment: Emily: I've signed the CLA, just waiting for it to be checked. ---------- nosy: +Henk-Jaap Wagenaar _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue26656> _______________________________________

Mariatta Wijaya added the comment: 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/ed94a8b2851914bcda3a77b28b25517b8ba... ---------- nosy: +Mariatta _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue26656> _______________________________________

Changes by Mariatta Wijaya <mariatta.wijaya@gmail.com>: ---------- pull_requests: +3267 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue26656> _______________________________________

Mariatta Wijaya added the comment: 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/83e5c888fff2bf3663952b2bfd3a3ee6c20... ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue26656> _______________________________________

Mariatta Wijaya added the comment: There are two PRs for this issue. I accepted the earlier one, and it's been backported to 3.6. Thanks everyone. ---------- resolution: -> fixed stage: -> resolved status: open -> closed versions: -Python 3.5 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue26656> _______________________________________

Changes by Roundup Robot <devnull@psf.upfronthosting.co.za>: ---------- pull_requests: +3268 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue26656> _______________________________________
participants (12)
-
Elena Oat
-
Emily Morehouse
-
Henk-Jaap Wagenaar
-
Mariatta Wijaya
-
Matthew Barnett
-
Raymond Hettinger
-
Roundup Robot
-
Serhiy Storchaka
-
Stéphane Wirtel
-
swapnil agarwal
-
Sworddragon
-
SylvainDe