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

Alex Martelli aleaxit at yahoo.com
Tue Sep 23 03:46:18 EDT 2003


On Monday 22 September 2003 06:56 pm, Barry Scott wrote:
> >I'm all for it.  I've had to implement rsplit on my own as well, and
> > always lamented (but never did anything, unfortunately) about its lack in
> > the standard library.  That strings have rfind, rindex, rstrip, and
> > rjust, but not rsplit always seemed somewhat less than complete to me.
>
> These "r" are not a single family... some mean reverse some mean right.

???  They are: 

>>> [x for x in dir('') if x[:1]=='r']
['replace', 'rfind', 'rindex', 'rjust', 'rstrip']

'replace' is clearly distinct from the other (it's not an 'eplace' from the 
right:-).  All others can be read as "from the right" (reading them as
"reverse" is very obviously strained).  Find and Index the rightmost
occurrence, right-justify, strip characters from the right of the string.


Alex




More information about the Python-Dev mailing list