On 7/1/2019 1:57 PM, Chris Barker via Python-Dev wrote:
This was quite extensively discussed on python-ideas recently:
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
'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.