-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
bpo-39939: Add str.removeprefix and str.removesuffix #18939
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
Changes from all commits
0addc43
3adb9fa
a7a1bc8
fe18644
ff8e3c6
5339a46
cc85978
1442ffe
111b0f9
8265e4d
7401b87
e550171
0a5d0a9
a126438
fbc4a50
3783dc3
428e733
5796757
6fe9ac5
13e8296
49fa220
550beca
01d0655
3c0e350
fe80ba8
ae23692
a9e253c
4c33b74
4413e2e
5dfa968
aa6eede
d941711
f55836d
8d0584a
8b6267a
61cd530
ffe72f1
d8f5a99
3df1f38
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -105,6 +105,16 @@ Merge (``|``) and update (``|=``) operators have been added to the built-in | |
:class:`dict` class. See :pep:`584` for a full description. | ||
(Contributed by Brandt Bucher in :issue:`36144`.) | ||
|
||
PEP 616: New removeprefix() and removesuffix() string methods | ||
------------------------------------------------------------- | ||
|
||
:meth:`str.removeprefix(prefix)<str.removeprefix>` and | ||
:meth:`str.removesuffix(suffix)<str.removesuffix>` have been added | ||
to easily remove an unneeded prefix or a suffix from a string. Corresponding | ||
``bytes``, ``bytearray``, and ``collections.UserString`` methods have also been | ||
added. See :pep:`616` for a full description. (Contributed by Dennis Sweeney in | ||
A93C | :issue:`18939`.) | |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, it's a typo error: @sweeneyde: can you please propose a PR to fix the typo? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or @elazarg: Do you want to propose a PR to fix the typo? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure. I thought it might be overkill :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oops -- It looks like that's the GitHub PR number rather than the bpo number. I can't make a PR tonight so feel free to change it. If not, I can fix it tomorrow. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
|
||
vstinner marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Other Language Changes | ||
====================== | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Added str.removeprefix and str.removesuffix methods and corresponding | ||
bytes, bytearray, and collections.UserString methods to remove affixes | ||
from a string if present. | ||
See :pep:`616` for a full description. | ||
Patch by Dennis Sweeney. |
Uh oh!
There was an error while loading. Please reload this page.