Mercurial > cpython-lru_cache-weakref
diff Lib/stringold.py @ 37052:ce267f68065e
More apply() cleanup
| author | Neal Norwitz <nnorwitz@gmail.com> |
|---|---|
| date | Fri, 17 Mar 2006 08:28:24 +0000 |
| parents | 4dcd78f3b5d1 |
| children | 1c26505c1de6 |
line wrap: on
line diff
--- a/Lib/stringold.py Fri Mar 17 08:27:50 2006 +0000 +++ b/Lib/stringold.py Fri Mar 17 08:28:24 2006 +0000 @@ -126,9 +126,6 @@ return sep.join(words) joinfields = join -# for a little bit of speed -_apply = apply - # Find substring, raise exception if not found def index(s, *args): """index(s, sub [,start [,end]]) -> int @@ -136,7 +133,7 @@ Like find but raises ValueError when the substring is not found. """ - return _apply(s.index, args) + return s.index(*args) # Find last substring, raise exception if not found def rindex(s, *args): @@ -145,7 +142,7 @@ Like rfind but raises ValueError when the substring is not found. """ - return _apply(s.rindex, args) + return s.rindex(*args) # Count non-overlapping occurrences of substring def count(s, *args): @@ -156,7 +153,7 @@ interpreted as in slice notation. """ - return _apply(s.count, args) + return s.count(*args) # Find substring, return -1 if not found def find(s, *args): @@ -169,7 +166,7 @@ Return -1 on failure. """ - return _apply(s.find, args) + return s.find(*args) # Find last substring, return -1 if not found def rfind(s, *args): @@ -182,7 +179,7 @@ Return -1 on failure. """ - return _apply(s.rfind, args) + return s.rfind(*args) # for a bit of speed _float = float @@ -224,7 +221,7 @@ # error message isn't compatible but the error type is, and this function # is complicated enough already. if type(s) == _StringType: - return _apply(_int, args) + return _int(*args) else: raise TypeError('argument 1: expected string, %s found' % type(s).__name__) @@ -252,7 +249,7 @@ # error message isn't compatible but the error type is, and this function # is complicated enough already. if type(s) == _StringType: - return _apply(_long, args) + return _long(*args) else: raise TypeError('argument 1: expected string, %s found' % type(s).__name__)
