[Python-Dev] Re: PEP 616 -- String methods to remove prefixes and suffixes

2020年3月23日 15:44:08 -0700

On 22Mar2020 23:33, Rob Cliffe <[email protected]> wrote:
Sorry, another niggle re handling an empty affix: With your Python implementation,
'aba'.cutprefix(('', 'a')) == 'aba'
'aba'.cutsuffix(('', 'a')) == 'ab'
This seems surprising.
That surprises me too. I expect the first matching affix to be used. It is the only way for the caller to have a predictable policy. As a diversion, _are_ there use cases where an empty affix is useful or reasonable or likely?
Cheers,
Cameron Simpson <[email protected]>
_______________________________________________
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/ZL4HWLP7TI3CAKM65WXXGTTTE77A7YSL/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to