[Python-ideas] str.rreplace
Serhiy Storchaka
storchaka at gmail.com
Sat Jan 25 08:11:23 CET 2014
25.01.14 02:05, Nick Coghlan написав(ла):
> Strings already provide rfind and rindex (they're just not part of the
> general sequence API).
>
> Since strings are immutable, there's also no call for an "rremove".
>
> rreplace (pronounced as 'ar-replace", like "ar-split" et al) is more
> obvious than a negative count, and seems like an almost exact parallel
> to rsplit.
>
> On the other hand, I don't recall ever lamenting its absence. Call me +0
> on the idea.
I'm between -0 and +0. On one hand there are precedents, meaning of
these methods looks clear and consistent with others, and the cost of
adding these methods are pretty low. On other hand, the cost is larger
than zero, and these methods are needed very rarely (and there are other
ways to do it).
In case of doubts I think the status quo wins.
More information about the Python-ideas
mailing list