On Sun, Mar 24, 2019 at 2:47 AM Alex Grigoryev <evr...@gmail.com> wrote:

> Yeah good idea with names because php ltrim does the same as lstrip in
> python.
> Normally I'd expect strip to behave as I proposed, not like input a string
> as mask of characters, which is more rare use case and confusing in some
> scenarios.
>

I agree -- I actually wrote buggy code in a PyPi published package that
incorrectly used strip(*) in this way: i.e. I expected.

My bad for not reading the docs carefully and writing crappy tests (yes,
there were tests -- shows you how meaningless 100% coverage is)

So +1 for some version of "remove exactly this substring from the left or
right of a string" I agree that the "either end" option is unlikley to be
useful, and it the rare case you want it, you can call both.

I'll let others bikeshed on the name.

And this really is simple enough that I don't want to reach for regex's for
it. That is, I'd write it by hand rather than mess with that.

-CHB


-- 
Christopher Barker, PhD

Python Language Consulting
  - Teaching
  - Scientific Software Development
  - Desktop GUI and Web Development
  - wxPython, numpy, scipy, Cython
_______________________________________________
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