[Python-ideas] New explicit methods to trim strings

Stephen J. Turnbull turnbull.stephen.fw at u.tsukuba.ac.jp
Sat Mar 30 14:03:03 EDT 2019

Anders Hovmöller writes:

 > That isn't the proposal as it stands now. The consensus among those
 > supporting the idea is "strip_prefix" and "strip_suffix". Let's
 > debate that.

IMO, the "prefix" and "suffix" parts are necessary to fully clarify
the intent (and do that well), so any of the verbs "strip", "trim", or
"cut" work for me.  I prefer Steven d'A's "cutprefix" and "cutsuffix"
as the shortest, and by analogy to startswith/endswith, I'd drop the
underscore (PEP 8 nothwithstanding).

More information about the Python-ideas mailing list