Document `re.Scanner`

Open Beginner friendly
#106,338 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
74/100
Issue type
Documentation
Clarity
Mostly clear
Activity status
Active
Tech stack
python
Domain
documentation

Research direction

Start with the linked Lib/re/init.py location and review the existing re documentation around Scanner. Add a concise description of what re.Scanner does and consider the proposed example docstring. Done means the standard-library documentation explains the feature clearly and reflects its practical use.

Written by the indexing model from the issue text.

Description

docs topic-regex

Documentation

re.Scanner is currently marked as "experimental" but was added to the standard library 24 years ago[0].
People seem to think this is an interesting feature[1][2] and a github code search for re.Scanner( gives >500 hits[3],
suggesting people have found practical uses for the class.

Proposal

I suggest we add a few lines to the docs describing what it is and perhaps a short docstring with an example.

Some previously collated discussions:
https://github.com/python/cpython/issues/91308#issuecomment-1093947379

[0]. https://github.com/python/cpython/blob/dbefa88b27ee1f124f782363b139aee3f1ccf590/Lib/re/__init__.py#L327
[1]. https://news.ycombinator.com/item?id=36517749
[2]. https://www.reddit.com/r/ProgrammerTIL/comments/4tpt03/python_til_about_rescanner_which_is_useful_for/
[3]. https://github.com/search?q=re.Scanner%28+language%3APython&type=code

Dominant language
Python
Stars
77.2k
Forks
36k
Avg merge
1d 10h
Merged PRs (30d)
560

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from python/cpython

All issues in python/cpython

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.