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 

    assert s == ''+s == s+''

so removing the empty string should obey the same invariant:

    assert s == s.removeprefix('') == s.removesuffix('')

Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
Message archived at 
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to