On 7/1/2019 1:57 PM, Chris Barker via Python-Dev wrote:
This was quite extensively discussed on python-ideas recently:
https://mail.python.org/archives/list/python-id...@python.org/thread/RJARZSUKCXRJIP42Z2YBBAEN5XA7KEC3/#WIRID57ESUFUAQQQ6ZUY2RK5PKQQYSJ3
The claim of 'inconsistent results' is based on not reading the doc.
(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 did not read much of the thread, but the proposal is to wrap a
near-trivial expression (2 operations) or replace a current method call
with a method call than is more or less the same len as what it replaces.
>>> 'prefix_more_suffix'[len('prefix'):] # if know s begins with p
'_more_suffix'
>>> 'prefix_more_suffix'.replace('prefix', '')
'_more_suffix'
>>> 'prefix_more_suffix'.strip_pre('prefix') # proposed
A method could raise instead of returning the string as-is if the prefix
is not really a prefix. How often is this needed? The most common end
deletions are whitespace, which the current .strip handles correctly.
--
Terry Jan Reedy
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@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/XG7GKASUSTVJPNOVMUNNDBUDEJFLYBT3/