On Tue, Mar 24, 2020 at 07:14:16PM +0100, Victor Stinner wrote: > I would prefer to raise ValueError("empty separator") to avoid any > risk of confusion. I'm not sure that str.cutprefix("") or > str.cutsuffix("") does make any sense.
They make as much sense as any other null-operation, such as subtracting 0 or deleting empty slices from lists. Every string s is unchanged if you prepend or concatenate the empty string: assert s == ''+s == s+'' so removing the empty string should obey the same invariant: assert s == s.removeprefix('') == s.removesuffix('') -- Steven _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/X7N57XKA3S7TK4W6OUJBCCLDSTERK636/ Code of Conduct: http://python.org/psf/codeofconduct/