Mercurial > hg
comparison mercurial/strutil.py @ 8155:b7cdfa2527be
strutil: removed rsplit
author | Martin Geisler <mg@lazybytes.net> |
---|---|
date | Fri, 24 Apr 2009 17:32:18 +0200 |
parents | aecea6934fdd |
children | 46293a0c7e9f |
comparison
equal
deleted
inserted
replaced
8154:06f1e4e309ed | 8155:b7cdfa2527be |
---|---|
30 c = haystack.rfind(needle, start, end) | 30 c = haystack.rfind(needle, start, end) |
31 if c == -1: | 31 if c == -1: |
32 break | 32 break |
33 yield c | 33 yield c |
34 end = c - 1 | 34 end = c - 1 |
35 | |
36 def rsplit(s, sep=None, maxsplit=-1): | |
37 try: | |
38 return s.rsplit(sep, maxsplit) | |
39 except AttributeError: | |
40 return [chunk[::-1] for chunk in | |
41 s[::-1].split(sep, maxsplit)[::-1]] |