This was quite extensively discussed on python-ideas recently:

https://mail.python.org/archives/list/python-ideas@python.org/thread/RJARZSUKCXRJIP42Z2YBBAEN5XA7KEC3/#WIRID57ESUFUAQQQ6ZUY2RK5PKQQYSJ3

(I'm finding it hard to find a good thread view in the new interface -- but that will get you started)

My memory of that thread is that there was a lot of bike shedding, and quite a lot of resistance to adding a couple new methods, which I personally never understood (Not why we don't want to add methods willy-nilly, but why there was this much resistance to what seems like an low-disruption, low maintenance, and helpful addition)

I think it just kind of petered out, rather than being rejected, so if someone wants to take up the mantle, that would be great -- and some support from a core dev or two would probably help.

-CHB




On Fri, Jun 28, 2019 at 10:44 AM Brett Cannon <brett@python.org> wrote:
Glenn Linderman wrote:
> On 6/27/2019 3:09 PM, Brett Cannon wrote:
> > My guess is that without Guido to just ask this will
> > have to go to a PEP as it changes a built-in.
> > How does adding two new methods change a built-in?
> > Now if an extra parameter were added to modify lstrip, rstrip, and strip
> to make them do something different, yes.
> But adding new methods doesn't change anything, unless someone is
> checking for their existence.

Sure, but the built-ins are so widely used that we don't want to blindly add every method idea that someone comes up with either. We all very much share ownership of the built-ins, so we should all agree to changes to them, and getting agreement means either clear consensus and/or a PEP.

-Brett

> My preferred color is  pstrip and sstrip (prefix and suffix strip) since
> lstrip and rstrip mean left and right.
> And maybe there should be a psstrip, that takes two parameters, the
> prefix and the suffix to strip.
> Such functions would certainly reduce code in a lot of places where I do
> if  string.startswith('foo'):
>      string = string[ 3: ];
> as well as making it more robust, because the string and its length have
> to stay synchronized when changes are made.
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-leave@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/SB6JECL6BUPF4Q37Q5SAGMDOQ2DI2GP5/


--

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker@noaa.gov