Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7c30724

Browse files
committed
More apply() cleanup
1 parent ade612b commit 7c30724

2 files changed

Lines changed: 9 additions & 12 deletions

File tree

Lib/logging/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,7 @@ def exception(self, msg, *args):
10151015
"""
10161016
Convenience method for logging an ERROR with exception information.
10171017
"""
1018-
self.error(msg, *args, exc_info=1)
1018+
self.error(msg, exc_info=1, *args)
10191019

10201020
def critical(self, msg, *args, **kwargs):
10211021
"""
@@ -1292,7 +1292,7 @@ def exception(msg, *args):
12921292
Log a message with severity 'ERROR' on the root logger,
12931293
with exception information.
12941294
"""
1295-
error(msg, *args, exc_info=1)
1295+
error(msg, exc_info=1, *args)
12961296

12971297
def warning(msg, *args, **kwargs):
12981298
"""

Lib/stringold.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -126,17 +126,14 @@ def join(words, sep = ' '):
126126
return sep.join(words)
127127
joinfields = join
128128

129-
# for a little bit of speed
130-
_apply = apply
131-
132129
# Find substring, raise exception if not found
133130
def index(s, *args):
134131
"""index(s, sub [,start [,end]]) -> int
135132
136133
Like find but raises ValueError when the substring is not found.
137134
138135
"""
139-
return _apply(s.index, args)
136+
return s.index(*args)
140137

141138
# Find last substring, raise exception if not found
142139
def rindex(s, *args):
@@ -145,7 +142,7 @@ def rindex(s, *args):
145142
Like rfind but raises ValueError when the substring is not found.
146143
147144
"""
148-
return _apply(s.rindex, args)
145+
return s.rindex(*args)
149146

150147
# Count non-overlapping occurrences of substring
151148
def count(s, *args):
@@ -156,7 +153,7 @@ def count(s, *args):
156153
interpreted as in slice notation.
157154
158155
"""
159-
return _apply(s.count, args)
156+
return s.count(*args)
160157

161158
# Find substring, return -1 if not found
162159
def find(s, *args):
@@ -169,7 +166,7 @@ def find(s, *args):
169166
Return -1 on failure.
170167
171168
"""
172-
return _apply(s.find, args)
169+
return s.find(*args)
173170

174171
# Find last substring, return -1 if not found
175172
def rfind(s, *args):
@@ -182,7 +179,7 @@ def rfind(s, *args):
182179
Return -1 on failure.
183180
184181
"""
185-
return _apply(s.rfind, args)
182+
return s.rfind(*args)
186183

187184
# for a bit of speed
188185
_float = float
@@ -224,7 +221,7 @@ def atoi(*args):
224221
# error message isn't compatible but the error type is, and this function
225222
# is complicated enough already.
226223
if type(s) == _StringType:
227-
return _apply(_int, args)
224+
return _int(*args)
228225
else:
229226
raise TypeError('argument 1: expected string, %s found' %
230227
type(s).__name__)
@@ -252,7 +249,7 @@ def atol(*args):
252249
# error message isn't compatible but the error type is, and this function
253250
# is complicated enough already.
254251
if type(s) == _StringType:
255-
return _apply(_long, args)
252+
return _long(*args)
256253
else:
257254
raise TypeError('argument 1: expected string, %s found' %
258255
type(s).__name__)

0 commit comments

Comments
 (0)