-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Curried versions of endswith and startswith #35052
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like just two test cases would cover everything?
I started out with a definition of the curried versions including In any case, the extra tests certainly don't hurt, do they? |
They don't in this case since they're fast and cheap to do but they will get run a lot. |
Makes sense. I'll leave them as they are then unless someone objects. |
fadbdba
to
2b35cf2
Compare
I've added a NEWS.md entry and compat annotations. (I also rebased onto master.) |
See discussion in #33193.
This PR adds single-argument versions
endswith(s)
andstartswith(s)
that return functions semantically equivalent tox->endswith(x,s)
andx->startswith(x,s)
, respectively.Example use case:
filter(endswith(".toml"), readdir())
Closes #33193.