[Python-Dev] Discussion on adding rsplit() for strings and unicode objects.

Alex Martelli aleaxit at yahoo.com
Sun Sep 21 14:42:45 EDT 2003


On Friday 19 September 2003 12:12 pm, Jeremy Fincher wrote:
> On Friday 19 September 2003 04:33 am, Sean Reifschneider wrote:
> > A few weeks ago I submitted a patch to add an rsplit() method to
> > string and unicode objects:
> > >Adding rsplit() to string and unicode objects. (2003-09-06)
> > >	http://python.org/sf/801847
>
> I'm all for it.  I've had to implement rsplit on my own as well, and always

Seconded (or thirded, whatever).  Actually had to do it just 3 days ago --
having a need for rsplit I in fact *wrote* my code as if it existed (didn't 
remember it wasn't there!!!), and it took a while to run tests and get the 
AttributeError, slap my forehead, and add a "def rsplit" function.  I think
it should be there by "principle of least surprise" -- experienced Python
coders *expect* it to be there (and I offer myself as an example;-).

> laden with.  As long as they're named appropriately, I can't see the harm
> in adding useful methods, especially one such as rsplit that completes a
> set of front-to-back/back-to-front methods.

Absolutely, but limited to those methods that "should" be there, for
completeness, and because they're expected.  rsplit is the outstanding
one that I can think of right now (because I just happened to need it
so recently, of course, and the coincidence of it being discussed now).


Alex




More information about the Python-Dev mailing list