> Steven D'Aprano:
> 
> Stephen J. Turnbull:
> 
>> And the bikeshedding isn't hard.  In the list above, cutprefix/
>> cutsuffix are far and away the best.
> 
> Well I'm glad we agree on that, even if nothing else :-)

I prefer “strip_prefix” because of the analogy to strip() which doesn’t do 
anything if the characters aren’t present. Introducing a new word “cut” seems 
unnecessary and confusing and I’d wager it will increase the probability of:

if s.startswith(‘foo’):
        s = s.cutprefix(‘foo’)

Obviously this is a guess!

I also don’t understand why not using the underscore is preferable? It seems 
just to be poor form.

/ Anders
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to