[issue39939] PEP 616: Add str methods to remove prefix or suffix

2020-04-22 Thread STINNER Victor
STINNER Victor added the comment: New changeset a81849b0315277bb39372711745059c0b445 by sweeneyde in branch 'master': bpo-39939: Add str.removeprefix and str.removesuffix (GH-18939) https://github.com/python/cpython/commit/a81849b0315277bb39372711745059c0b445 -- ___

[issue39939] PEP 616: Add str methods to remove prefix or suffix

2020-04-21 Thread Dennis Sweeney
Dennis Sweeney added the comment: Oops -- I now see the message on Python-Dev. -- ___ Python tracker ___ ___ Python-bugs-list maili

[issue39939] PEP 616: Add str methods to remove prefix or suffix

2020-04-21 Thread Dennis Sweeney
Dennis Sweeney added the comment: I'm personally -0 for underscores -- they might slightly improve readability of the function name in isolation but may also add confusion about which methods have underscores. Only one out of the 45 non-dunder str methods has an underscore right now: >

[issue39939] PEP 616: Add str methods to remove prefix or suffix

2020-04-20 Thread Raymond Hettinger
Raymond Hettinger added the comment: I disagree with the rationale given in the PEP. The reason that "startswith" and "endswith" don't have underscores is that the aren't needed to disambiguate the text. Our rules are to add underscores when it improves readability, which in this case it d

[issue39939] PEP 616: Add str methods to remove prefix or suffix

2020-04-20 Thread STINNER Victor
STINNER Victor added the comment: > Please add an underscore to the names: remove_prefix(). and remove_suffix(). The PEP 616 was approved with removeprefix() and removesuffix() names. The rationale for the names can be even found in the PEP: https://www.python.org/dev/peps/pep-0616/#alternat

[issue39939] PEP 616: Add str methods to remove prefix or suffix

2020-04-20 Thread Raymond Hettinger
Raymond Hettinger added the comment: Please add an underscore to the names: remove_prefix(). and remove_suffix(). The latter method causes a mental hiccup when first reading as removes-uffix, forcing mental backtracking to get to remove-suffix. We had a similar problem with addinfourl initi

[issue39939] PEP 616: Add str methods to remove prefix or suffix

2020-04-20 Thread STINNER Victor
STINNER Victor added the comment: When, I even expect that some people use .strip() whereas their intent was to use .lstrip(): >>> "Python vs Monty Python".strip("Python") ' vs Monty ' Again, strip() is used with a string whereas the real intent was to use removesuffix() which didn't exist

[issue39939] PEP 616: Add str methods to remove prefix or suffix

2020-04-20 Thread STINNER Victor
STINNER Victor added the comment: The documentation should explain well the difference between removeprefix()/removesuffix() and lstrip()/strip()/rstrip(), since it is the rationale of the PEP ;-) An example that can be used to explain the difference: >>> "Monty Python".removesuffix(" Pytho

[issue39939] PEP 616: Add str methods to remove prefix or suffix

2020-04-10 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +18809 pull_request: https://github.com/python/cpython/pull/19455 ___ Python tracker ___ __

[issue39939] PEP 616: Add str methods to remove prefix or suffix

2020-03-25 Thread STINNER Victor
STINNER Victor added the comment: Dennis Sweeney wrote https://www.python.org/dev/peps/pep-0616/ -- title: Add str methods to remove prefixes or suffixes -> PEP 616: Add str methods to remove prefix or suffix ___ Python tracker