[Python-ideas] New explicit methods to trim strings

Paul Moore p.f.moore at gmail.com
Mon Mar 25 14:31:35 EDT 2019


On Mon, 25 Mar 2019 at 17:49, Anders Hovmöller <boxed at killingar.net> wrote:
>
> > All of this would be well served by a 3rd party library on PyPI.  Strings already have plenty of methods (probably too many).  Having `stringtools` would be nice to import a bunch of simple functions from.
>
> I respectfully disagree. This isn't javascript where we are OK with millions of tiny dependencies. Python is batteries included and that's a great thing. This is just a tiny battery that was overlooked :)

While batteries included is a very good principle (and one I've argued
for strongly in the past) it's also important to remember that Python
is a mature language, and the days of being able to assume that "most
people" will be on a recent version are gone. Adding these functions
to the stdlib would mean that *only* people using Python 3.8+ would
have access to them (and in particular, library authors wouldn't be
able to use them until they drop support for all versions older than
3.8). Having the functions as an external library makes them
accessible to *every* Python user.

As with everything, it's a trade-off. IMO, in this case the balance is
in favour of a 3rd party library (at least initially - it's perfectly
possible to move the library into the stdlib later if it becomes
popular).

Paul


More information about the Python-ideas mailing list