On Sat, Mar 7, 2020 at 3:01 PM Cameron Simpson <cs@cskk.id.au> wrote:
Like yours, they return the original object if unchanged.

that makes me uncomfortable, but I guess as srings are mutable (an may be interned, why not?)

Do the other string methods return themselves if there is no change?

As for the "required" idea -- an optional keyword only parameter could be useful, but definitely not the default behavior. That would be incompatible with all the other string methods. Though personally, I think I'd still check that a string "follows the rules" I expect outside this function anyway.

-CHB


--
Christopher Barker, PhD

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