On 08Mar2020 00:17, MRAB <python@mrabarnett.plus.com> wrote:
On 2020-03-07 23:01, Cameron Simpson wrote:
I'm somewhat against "strip" in the name, because Python's plain "strip" methods act like PHP and Go trim methods: they strip multiple characters, not fixed strings.
My own preference (and personal library use) is cutprefix and cutsuffix.
Go's Trim strips multiple characters, but, as far as I can tell from the docs, TrimPrefix and TrimSuffix strip a single prefix/suffix string.
And right there is the confusion I'd rather avoid. I'd like the affix stuff to have a different name because it behaves differently. We've got strip, lstrip and rstrip with common "strip multiple characters" actions. I think fixed affixes are different enough to warrant a differently spelled name. I hope we can agree to at least avoid using the word "trim", for similar reasons. Cheers, Cameron Simpson <cs@cskk.id.au>