<div dir="ltr">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.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Mar 25, 2019 at 10:45 AM Alex Grigoryev <<a href="mailto:evrial@gmail.com">evrial@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>strip_prefix and strip_suffix I think are the best names from all and work perfectly with auto completion. Common use case:</div><code><pre style="background-color:rgba(0,0,0,0.05);padding:0.2em 1em">"      mailto:<a href="mailto:maria@gmail.com" target="_blank">maria@gmail.com</a>".strip().strip_prefix("mailto:")</pre></code><br><div class="gmail-m_6837131815186708064gmail_quote_attribution">On Mar 25 2019, at 4:40 pm, Anders Hovmöller <<a href="mailto:boxed@killingar.net" target="_blank">boxed@killingar.net</a>> wrote:</div><blockquote><div><br><blockquote><div>Earlier, Anders wrote:</div><div>I propose naming them strip_prefix() and strip_suffix() and just skip the one that does both sides since it makes no sense to me.</div><br><div>This is good, except I prefer subtract_prefix(a, b), truncate_suffix etc. And for the two step process prefix_subtractor(a)(b) etc.</div></blockquote><br><div>I don't understand the logic for "subtract". That's not a thing for non-numbers.</div><br><div>If you don't think "strip" is good, then I suggest "remove". Or one could also consider "without" since we're talking about something that removes /if present/ (making subtract even worse! Subtract doesn't stop at zero). So "without_prefix()".</div><div>_______________________________________________</div><div>Python-ideas mailing list</div><div><a href="mailto:Python-ideas@python.org" target="_blank">Python-ideas@python.org</a></div><div><a href="https://mail.python.org/mailman/listinfo/python-ideas" target="_blank">https://mail.python.org/mailman/listinfo/python-ideas</a></div><div>Code of Conduct: <a href="http://python.org/psf/codeofconduct/" target="_blank">http://python.org/psf/codeofconduct/</a></div></div></blockquote><img class="gmail-m_6837131815186708064mailspring-open" alt="Sent from Mailspring" width="0" height="0" style="border: 0px; width: 0px; height: 0px;" src="https://link.getmailspring.com/open/1E2D83BC-326E-4278-A46C-7FE4F7FE2560@getmailspring.com?recipient=cHl0aG9uLWlkZWFzQHB5dGhvbi5vcmc%3D">_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org" target="_blank">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer" target="_blank">http://python.org/psf/codeofconduct/</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature">Keeping medicines from the bloodstreams of the sick; food <br>from the bellies of the hungry; books from the hands of the <br>uneducated; technology from the underdeveloped; and putting <br>advocates of freedom in prisons.  Intellectual property is<br>to the 21st century what the slave trade was to the 16th.<br></div>