summaryrefslogtreecommitdiffstats
path: root/Tools/pybench
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-05-16 17:02:34 (GMT)
committerGeorg Brandl <georg@python.org>2008-05-16 17:02:34 (GMT)
commitbf82e374ee737992235cbe944c9ddbd58236a892 (patch)
treef8c8dccaa76d58f9cb7d8cc0abb1355be75ee369 /Tools/pybench
parentacbca71ea775fc488bead0876d0cdbd48670dcbc (diff)
downloadcpython-bf82e374ee737992235cbe944c9ddbd58236a892.zip
cpython-bf82e374ee737992235cbe944c9ddbd58236a892.tar.gz
cpython-bf82e374ee737992235cbe944c9ddbd58236a892.tar.bz2
More 2to3 fixes in the Tools directory. Fixes #2893.
Diffstat (limited to 'Tools/pybench')
-rw-r--r--Tools/pybench/CommandLine.py6
-rw-r--r--Tools/pybench/Lists.py4
-rw-r--r--Tools/pybench/With.py18
-rw-r--r--Tools/pybench/clockres.py3
-rwxr-xr-xTools/pybench/pybench.py10
5 files changed, 19 insertions, 22 deletions
diff --git a/Tools/pybench/CommandLine.py b/Tools/pybench/CommandLine.py
index d0142f8..d6ef0be 100644
--- a/Tools/pybench/CommandLine.py
+++ b/Tools/pybench/CommandLine.py
@@ -537,9 +537,9 @@ class Application:
if not options:
print(' None')
return
- long = filter(lambda x: x.prefix == '--', options)
- short = filter(lambda x: x.prefix == '-', options)
- items = short + long
+ int = [x for x in options if x.prefix == '--']
+ short = [x for x in options if x.prefix == '-']
+ items = short + int
for o in options:
print(' ',o)
print()
diff --git a/Tools/pybench/Lists.py b/Tools/pybench/Lists.py
index 9aeb408..c39687e 100644
--- a/Tools/pybench/Lists.py
+++ b/Tools/pybench/Lists.py
@@ -157,8 +157,8 @@ class ListSlicing(Test):
def calibrate(self):
- n = range(100)
- r = range(25)
+ n = list(range(100))
+ r = list(range(25))
for i in range(self.rounds):
for j in r:
diff --git a/Tools/pybench/With.py b/Tools/pybench/With.py
index 3af24cc..5f59e8c 100644
--- a/Tools/pybench/With.py
+++ b/Tools/pybench/With.py
@@ -17,7 +17,7 @@ class WithFinally(Test):
cm = self.ContextManager()
- for i in xrange(self.rounds):
+ for i in range(self.rounds):
with cm: pass
with cm: pass
with cm: pass
@@ -43,7 +43,7 @@ class WithFinally(Test):
cm = self.ContextManager()
- for i in xrange(self.rounds):
+ for i in range(self.rounds):
pass
@@ -65,7 +65,7 @@ class TryFinally(Test):
cm = self.ContextManager()
- for i in xrange(self.rounds):
+ for i in range(self.rounds):
cm.__enter__()
try: pass
finally: cm.__exit__()
@@ -150,7 +150,7 @@ class TryFinally(Test):
cm = self.ContextManager()
- for i in xrange(self.rounds):
+ for i in range(self.rounds):
pass
@@ -171,12 +171,12 @@ class WithRaiseExcept(Test):
error = ValueError
be = self.BlockExceptions()
- for i in xrange(self.rounds):
+ for i in range(self.rounds):
with be: raise error
with be: raise error
- with be: raise error,"something"
- with be: raise error,"something"
- with be: raise error,"something"
+ with be: raise error("something")
+ with be: raise error("something")
+ with be: raise error("something")
with be: raise error("something")
with be: raise error("something")
with be: raise error("something")
@@ -186,5 +186,5 @@ class WithRaiseExcept(Test):
error = ValueError
be = self.BlockExceptions()
- for i in xrange(self.rounds):
+ for i in range(self.rounds):
pass
diff --git a/Tools/pybench/clockres.py b/Tools/pybench/clockres.py
index 42f5ee7..d7f1ac8 100644
--- a/Tools/pybench/clockres.py
+++ b/Tools/pybench/clockres.py
@@ -23,8 +23,7 @@ def clockres(timer):
break
for i in spin_loops:
d[timer()] = 1
- values = d.keys()
- values.sort()
+ values = sorted(d.keys())
min_diff = TEST_TIME
for i in range(len(values) - 1):
diff = values[i+1] - values[i]
diff --git a/Tools/pybench/pybench.py b/Tools/pybench/pybench.py
index 781b4f8..771d7ac 100755
--- a/Tools/pybench/pybench.py
+++ b/Tools/pybench/pybench.py
@@ -107,15 +107,13 @@ def get_machine_details():
buildno, builddate = platform.python_build()
python = platform.python_version()
try:
- unichr(100000)
+ chr(100000)
except ValueError:
# UCS2 build (standard)
- unicode = 'UCS2'
- except NameError:
- unicode = None
+ unitype = 'UCS2'
else:
# UCS4 build (most recent Linux distros)
- unicode = 'UCS4'
+ unitype = 'UCS4'
bits, linkage = platform.architecture()
return {
'platform': platform.platform(),
@@ -127,7 +125,7 @@ def get_machine_details():
'compiler': platform.python_compiler(),
'buildno': buildno,
'builddate': builddate,
- 'unicode': unicode,
+ 'unicode': unitype,
'bits': bits,
}