[Python-ideas] str.rreplace

Serhiy Storchaka storchaka at gmail.com
Sat Jan 25 08:16:17 CET 2014


24.01.14 23:04, MRAB написав(ла):
> On 2014-01-24 20:48, Chris Angelico wrote:
>> On Sat, Jan 25, 2014 at 7:33 AM,
>> <random832 at fastmail.us> wrote:
>>>>>> 'aaa'[::-1].replace('aa'[::-1],'x'[::-1])[::-1]
>>> 'ax'
>>
>> It makes me happy when the [::-1] smiley gets used that many times to
>> solve a problem. Very happy.
>>
>> Happy that it isn't in _my_ code, to be precise...
>>
> It's probably not as efficient, either!

Of course it is less efficient than hypothetical rreplace, but I suppose 
it is most efficient way in current Python.




More information about the Python-ideas mailing list