Commit 9315c300 authored by Fred Drake's avatar Fred Drake

Get rid of apply(); extended call syntax is not news anymore, and apply()

will generate a PendingDeprecationWarning in Python 2.3.
parent 18286c36
...@@ -88,7 +88,7 @@ class TALESTests(unittest.TestCase): ...@@ -88,7 +88,7 @@ class TALESTests(unittest.TestCase):
e = TALES.Engine() e = TALES.Engine()
e.registerType('simple', TALES.SimpleExpr) e.registerType('simple', TALES.SimpleExpr)
e.registerType('unicode', DummyUnicodeExpr) e.registerType('unicode', DummyUnicodeExpr)
return apply(e.getContext, (), kws) return e.getContext(**kws)
def testContext0(self): def testContext0(self):
'''Test use of Context''' '''Test use of Context'''
......
...@@ -90,7 +90,7 @@ class AltTALGenerator(TALGenerator): ...@@ -90,7 +90,7 @@ class AltTALGenerator(TALGenerator):
def emit(self, *args): def emit(self, *args):
if self.enabled: if self.enabled:
apply(TALGenerator.emit, (self,) + args) TALGenerator.emit(self, *args)
def emitStartElement(self, name, attrlist, taldict, metaldict, i18ndict, def emitStartElement(self, name, attrlist, taldict, metaldict, i18ndict,
position=(None, None), isend=0): position=(None, None), isend=0):
......
...@@ -33,14 +33,14 @@ from cStringIO import StringIO ...@@ -33,14 +33,14 @@ from cStringIO import StringIO
def time_apply(f, args, kwargs, count): def time_apply(f, args, kwargs, count):
for i in range(4): for i in range(4):
apply(f, args, kwargs) f(*args, **kwargs)
r = [None] * count r = [None] * count
t0 = time.clock() t0 = time.clock()
for i in r: for i in r:
pass pass
t1 = time.clock() t1 = time.clock()
for i in r: for i in r:
apply(f, args, kwargs) f(*args, **kwargs)
t = time.clock() - t1 - (t1 - t0) t = time.clock() - t1 - (t1 - t0)
return t / count return t / count
......
...@@ -47,7 +47,7 @@ def timefunc(count, func, *args): ...@@ -47,7 +47,7 @@ def timefunc(count, func, *args):
sys.stderr.flush() sys.stderr.flush()
t0 = time.clock() t0 = time.clock()
for i in range(count): for i in range(count):
result = apply(func, args) result = func(*args)
t1 = time.clock() t1 = time.clock()
sys.stderr.write("%6.3f secs for %d calls, i.e. %4.0f msecs per call\n" sys.stderr.write("%6.3f secs for %d calls, i.e. %4.0f msecs per call\n"
% ((t1-t0), count, 1000*(t1-t0)/count)) % ((t1-t0), count, 1000*(t1-t0)/count))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment