Skip to content

Almost all re functions take a compiled pattern. (Even re.compile()!) #203

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

Merged
merged 2 commits into from
May 16, 2016

Conversation

gvanrossum
Copy link
Member

Fixes #188

Note: I'm using AnyStr so that the type of string used for pattern and
for the rest of the arguments must match. This is not 100% correct,
since Python 2 sometimes allows mixed types. But sometimes it
doesn't, depending on the values (e.g. non-ASCII bytes), and Python 3
always insists on matching, so I think this is actually a good idea.

Fixes #188

Note: I'm using AnyStr so that the type of string used for pattern and
for the rest of the arguments must match.  This is not 100% correct,
since Python 2 sometimes allows mixed types.  But sometimes it
doesn't, depending on the values (e.g. non-ASCII bytes), and Python 3
always insists on matching, so I think this is actually a good idea.
@gvanrossum
Copy link
Member Author

Don't merge yet, I am working on the same thing for PY3.

@JukkaL
Copy link
Contributor

JukkaL commented May 16, 2016

It might be worthwhile to add some tests for these into the mypy Python evaluation test suite, as the overloads are a little tricky.

@gvanrossum gvanrossum merged commit 3e37029 into master May 16, 2016
@gvanrossum
Copy link
Member Author

Yeah, added some tests.

@gvanrossum gvanrossum deleted the newre branch May 16, 2016 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants