On 13.10.2021 17:11, Guido van Rossum wrote:
> Maybe we should only accept operators as aliases for existing methods.
> 
> x-y could mean x.removesuffix(y)

That was the idea, yes, in particular to make it similar to "+",
which adds to the end of the string, so that:

s = x - oldend + newend

works as expected.

> I don't think x~y is intuitive enough to use.

True.

I tried to find an operator that looked similar to "-", but
"~" would only work as unary operator, a Chris correctly pointed
out, and even if it were a binary one, it would look too
similar to "-" and also doesn't play well when used on a single
line.

s = newstart + (x ~ oldstart)

So I withdraw that proposal.

> On Wed, Oct 13, 2021 at 8:03 AM Stephen J. Turnbull 
> <stephenjturnb...@gmail.com
> <mailto: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".
> 
>     Steve
-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Experts (#1, Oct 13 2021)
>>> Python Projects, Coaching and Support ...    https://www.egenix.com/
>>> Python Product Development ...        https://consulting.egenix.com/
________________________________________________________________________

::: We implement business ideas - efficiently in both time and costs :::

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611
               https://www.egenix.com/company/contact/
                     https://www.malemburg.com/

_______________________________________________
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/TFUOXQAHBYZFON2BU2MQ62HI4HKNLCZX/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to