8000 Add example of named group to re.Match.__getitem__ doc · Issue #92727 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

Add example of named group to re.Match.__getitem__ doc #92727

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bmispelon opened this issue May 12, 2022 · 2 comments
Closed

Add example of named group to re.Match.__getitem__ doc #92727

bmispelon opened this issue May 12, 2022 · 2 comments
Labels
docs Documentation in the Doc dir topic-regex

Comments

@bmispelon
Copy link
Contributor

Documentation

The documentation for re.Match.__getitem__ only shows example of using positional capture groups (like matchobj[1]) but not named groups (like matchobj['foo']).

It mentions that "[...] is identical to m.group(g)" so you can infer that named groups work, but I think having an explicit example would encourage the adoption of the feature.

@bmispelon bmispelon added the docs Documentation in the Doc dir label May 12, 2022
bmispelon added a commit to bmispelon/cpython that referenced this issue May 12, 2022
@rhettinger
Copy link
Contributor

+1 This is a nice improvement.

miss-islington pushed a commit to miss-islington/cpython that referenced this issue May 28, 2022
…tem__ (pythonGH-92730)

(cherry picked from commit 642d1fa)

Co-authored-by: Baptiste Mispelon <bmispelon@gmail.com>
miss-islington added a commit that referenced this issue May 28, 2022
…H-92730)

(cherry picked from commit 642d1fa)

Co-authored-by: Baptiste Mispelon <bmispelon@gmail.com>
@slateny
Copy link
Contributor
slateny commented Aug 6, 2022

Resolved per #92730.

@slateny slateny closed this as completed Aug 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir topic-regex
Projects
None yet
Development

No branches or pull requests

4 participants
0