[Python-ideas] str.rreplace

spir denis.spir at gmail.com
Sat Jan 25 09:22:43 CET 2014


On 01/24/2014 07:20 PM, Andrew Barnert wrote:
> On Jan 24, 2014, at 9:43, Ethan Furman <ethan at stoneleaf.us> wrote:
>
>> On 01/24/2014 09:36 AM, Antoine Pitrou wrote:
>>> On Fri, 24 Jan 2014 19:30:00 +0200
>>> Serhiy Storchaka <storchaka at gmail.com>
>>> wrote:
>>>> 24.01.14 18:56, Antoine Pitrou написав(ла):
>>>>> On Fri, 24 Jan 2014 08:47:14 -0800 (PST)
>>>>> Ram Rachum <ram.rachum at gmail.com> wrote:
>>>>>> I propose implementing str.rreplace. (It'll be to str.replace what
>>>>>> str.rsplit is to str.split.)
>>>>>
>>>>> I suppose it only differs when the count parameter is supplied?
>>>>>
>>>>> I don't think it can hurt, except for the funny looks of its name.
>>>>> In any case, if str.rreplace is added then so should bytes.rreplace and
>>>>> bytearray.rreplace.
>>>>
>>>> bytearray.rremove, tuple.rindex, list.rindex, list.rremove.
>>>
>>> Not sure what those have to do with rreplace().
>>
>> The funny look of the name, I think.  ;)
>
> And the pronunciation. Hard to say it without sounding like a pirate. Although I guess you could interpret the rr as a rolled r: strrrrings have rrrrreplace thanks to rrrrachum.
>
> But the inclusion of rindex makes me think this was a serious suggestion to add r versions of all methods that involve searching. Which probably isn't worth the effort to do, but there's nothing really wrong with the idea.

Those methods would better have a logical param meaning "traverse backwards", imo.

D


More information about the Python-ideas mailing list