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

STINNER Victor report at bugs.python.org
Mon Apr 20 17:11:38 EDT 2020


STINNER Victor <vstinner at python.org> 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 ;-)

A note should be added to lstrip(), strip() and rstrip() documentation to point to removeprefix() and/or removesuffix().

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39939>
_______________________________________


More information about the Python-bugs-list mailing list