On 2021-10-14 at 00:00:25 +0900,
"Stephen J. Turnbull" <stephenjturnb...@gmail.com> wrote:

> Chris Angelico writes:
> 
>  > +1, although it's debatable whether it should be remove suffix or
>  > remove all. I'd be happy with either.
> 
> If by "remove all" you mean "efefef" - "ef" == "", I think that's a
> footgun.  Similarly for "efabcd" - "ef" == "abcdef" - "ef".

I don't know whether it qualifies as prior art, but in Erlang (a
language emphatically *not* known for its string handling), strings are
lists of codepoints, and the list subtraction operator¹ is spelled "--":

    The list subtraction operator -- produces a list that is a copy of
    the first argument. The procedure is a follows: for each element in
    the second argument, the first occurrence of this element (if any)
    is removed.

    Example:

    2> [1,2,3,2,1,2]--[2,1,2].
    [3,1,2]

And from my interactive prompt:

    4> "abcdef" -- "ef".
    "abcd"
    5> "abcdef" -- "ab".
    "cdef"

¹ http://erlang.org/doc/reference_manual/expressions.html#list-operations
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/WGIJAJSVR4XKXV4F34QFUIC65T7HE4N7/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to