On Sat, Mar 7, 2020 at 4:36 PM Cameron Simpson <cs@cskk.id.au> wrote:
>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.

Different than Go? or than existing Python methods? I think it's pretty much impossible for Python to remain in sync with other languages, we might well give up on that.

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.

That's why folks are suggesting "*prefix" and *suffix" -- the prefix and suffix make it pretty clear that something different is going on. And I at least think it's pretty descritive. I"ve lost track of what's on the table, but:

strip_prefix
strip_suffix

make it clear that it's something different than the other "strip"s, without gratuitously adding more words for the same thing. And it would show up alphabetically near "strip", which is also good.

I'm going to try to refrain from further bike shedding this one -- I'd rather see something done than get my favorite names :-)

-CHB


--
Christopher Barker, PhD

Python Language Consulting
  - Teaching
  - Scientific Software Development
  - Desktop GUI and Web Development
  - wxPython, numpy, scipy, Cython