[Python-ideas] New explicit methods to trim strings

Anders Hovmöller boxed at killingar.net
Mon Apr 1 01:15:15 EDT 2019



> On 1 Apr 2019, at 04:58, David Mertz <mertz at gnosis.cx> wrote:
> 
> 
>> Lacking a good set of semantics for removing multiple affixes at once, we shouldn't rush to guess what people want. You don't even know what behaviour YOU want, let alone what the community as a whole needs.
> 
> 
> This is both dumb and dishonest. There are basically two choices, both completely clear. I think the more obvious one is to treat several prefixes or suffixes as substring class, much as .[rl]strip() does character class. 

Please don't say "dumb and dishonest". Especially not when you directly follow up by radically redefining what you want.  To get the same semantics as strip() it must follow that

"foofoobarfoo".without_suffix(("foo", "bar")) == ""

/ Anders
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20190401/394bc2d9/attachment.html>


More information about the Python-ideas mailing list