Skip to content
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

bpo-30397: Add re.Pattern and re.Match. #1646

Merged
merged 6 commits into from
Oct 4, 2017

Conversation

serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented May 18, 2017

Also add and update docstrings.
Change __module__ of the error, Pattern and Match types.

https://bugs.python.org/issue30397

Also add and update docstrings.
Change __module__ of the error, Pattern and Match types.
@serhiy-storchaka serhiy-storchaka added the type-feature A feature request or enhancement label May 18, 2017
@mention-bot
Copy link

@serhiy-storchaka, thanks for your PR! By analyzing the history of the files in this pull request, we identified @benjaminp, @rosslagerwall and @Yhg1s to be potential reviewers.

Copy link
Member

@gvanrossum gvanrossum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this. I guess it's too scary to make these classes generic (like their counterparts in typing.py) -- after all we don't do that for other ABCs either.

@@ -690,7 +690,7 @@ PyDoc_STRVAR(_sre_SRE_Match_span__doc__,
"span($self, group=0, /)\n"
"--\n"
"\n"
"For MatchObject m, return the 2-tuple (m.start(group), m.end(group)).");
"For match object m, return the 2-tuple (m.start(group), m.end(group)).");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't that be "Match object"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know. The term "match object" is widely used in the documentation (unlikely to just added name Match).

@ilevkivskyi
Copy link
Member

Thanks for doing this. I guess it's too scary to make these classes generic (like their counterparts in typing.py) -- after all we don't do that for other ABCs either.

Yes. I was thinking about using these new classes in __extra__ attributes of typing types, like we do for collections ABCs, but there is some special casing for Pattern and Match in typing so that it is better to keep the typing types as is.

@serhiy-storchaka serhiy-storchaka merged commit 0b5e61d into python:master Oct 4, 2017
@serhiy-storchaka serhiy-storchaka deleted the re-pattern-pydoc branch October 4, 2017 17:09
vmalloc pushed a commit to mongomock/mongomock that referenced this pull request Jul 22, 2018
Hi there.
Python 3.7 removes `re._pattern_type` and renames it to `re.Pattern`.
python/cpython#1646
I also remove test for py3.3(point to python3.4, which is redudant) and add test for py3.6 & 3.7. :)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-feature A feature request or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants