[Python-ideas] New explicit methods to trim strings

Anders Hovmöller boxed at killingar.net
Mon Mar 25 10:40:44 EDT 2019


> Earlier, Anders wrote:
> I propose naming them strip_prefix() and strip_suffix() and just skip the one that does both sides since it makes no sense to me.
> 
> This is good, except I prefer subtract_prefix(a, b), truncate_suffix etc. And for the two step process prefix_subtractor(a)(b) etc.

I don't understand the logic for "subtract". That's not a thing for non-numbers. 

If you don't think "strip" is good, then I suggest "remove". Or one could also consider "without" since we're talking about something that removes /if present/ (making subtract even worse! Subtract doesn't stop at zero). So "without_prefix()". 


More information about the Python-ideas mailing list