mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
Merged revisions 77241 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r77241 | antoine.pitrou | 2010-01-02 22:12:58 +0100 (sam., 02 janv. 2010) | 4 lines Issue #7462: Implement the stringlib fast search algorithm for the `rfind`, `rindex`, `rsplit` and `rpartition` methods. Patch by Florent Xicluna. ........
This commit is contained in:
parent
2952148dd2
commit
da2ecaf334
10 changed files with 131 additions and 115 deletions
|
|
@ -767,6 +767,8 @@ class UserString(Sequence):
|
|||
new = new.data
|
||||
return self.__class__(self.data.replace(old, new, maxsplit))
|
||||
def rfind(self, sub, start=0, end=_sys.maxsize):
|
||||
if isinstance(sub, UserString):
|
||||
sub = sub.data
|
||||
return self.data.rfind(sub, start, end)
|
||||
def rindex(self, sub, start=0, end=_sys.maxsize):
|
||||
return self.data.rindex(sub, start, end)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue