[Python-3000-checkins] r53417 - python/branches/p3yk/Tools/pybench/CommandLine.py python/branches/p3yk/Tools/pybench/Dict.py python/branches/p3yk/Tools/pybench/Exceptions.py python/branches/p3yk/Tools/pybench/Lookups.py
guido.van.rossum
python-3000-checkins at python.org
Sun Jan 14 00:54:40 CET 2007
Author: guido.van.rossum
Date: Sun Jan 14 00:54:39 2007
New Revision: 53417
Modified:
python/branches/p3yk/Tools/pybench/CommandLine.py
python/branches/p3yk/Tools/pybench/Dict.py
python/branches/p3yk/Tools/pybench/Exceptions.py
python/branches/p3yk/Tools/pybench/Lookups.py
Log:
Fix pybench so it works -- Larry Hastings.
Modified: python/branches/p3yk/Tools/pybench/CommandLine.py
==============================================================================
--- python/branches/p3yk/Tools/pybench/CommandLine.py (original)
+++ python/branches/p3yk/Tools/pybench/CommandLine.py Sun Jan 14 00:54:39 2007
@@ -165,7 +165,7 @@
def __init__(self,name,help=None):
if not name[:1] == '-':
- raise TypeError,'option names must start with "-"'
+ raise TypeError('option names must start with "-"')
if name[1:2] == '-':
self.prefix = '--'
self.name = name[2:]
@@ -324,30 +324,32 @@
# Append preset options
for option in self.preset_options:
- if not self.option_map.has_key(option.name):
+ if not option.name in self.option_map:
self.add_option(option)
# Init .files list
self.files = []
# Start Application
+ rc = 0
try:
# Process startup
rc = self.startup()
if rc is not None:
- raise SystemExit,rc
+ raise SystemExit(rc)
# Parse command line
rc = self.parse()
if rc is not None:
- raise SystemExit,rc
+ raise SystemExit(rc)
# Start application
rc = self.main()
if rc is None:
rc = 0
- except SystemExit as rc:
+ except SystemExit as rcException:
+ rc = rcException
pass
except KeyboardInterrupt:
@@ -367,7 +369,7 @@
print
rc = 1
- raise SystemExit,rc
+ raise SystemExit(rc)
def add_option(self, option):
@@ -398,7 +400,7 @@
program. It defaults to 0 which usually means: OK.
"""
- raise SystemExit, rc
+ raise SystemExit(rc)
def parse(self):
@@ -459,7 +461,7 @@
except AttributeError:
if value == '':
# count the number of occurances
- if values.has_key(optionname):
+ if optionname in values:
values[optionname] = values[optionname] + 1
else:
values[optionname] = 1
@@ -468,7 +470,7 @@
else:
rc = handler(value)
if rc is not None:
- raise SystemExit, rc
+ raise SystemExit(rc)
# Apply final file check (for backward compatibility)
rc = self.check_files(self.files)
Modified: python/branches/p3yk/Tools/pybench/Dict.py
==============================================================================
--- python/branches/p3yk/Tools/pybench/Dict.py (original)
+++ python/branches/p3yk/Tools/pybench/Dict.py Sun Jan 14 00:54:39 2007
@@ -351,7 +351,7 @@
def test(self):
d = {}
- has_key = d.has_key
+ has_key = lambda key: key in d
for i in xrange(self.rounds):
@@ -498,7 +498,7 @@
def calibrate(self):
d = {}
- has_key = d.has_key
+ has_key = lambda key: key in d
for i in xrange(self.rounds):
pass
Modified: python/branches/p3yk/Tools/pybench/Exceptions.py
==============================================================================
--- python/branches/p3yk/Tools/pybench/Exceptions.py (original)
+++ python/branches/p3yk/Tools/pybench/Exceptions.py Sun Jan 14 00:54:39 2007
@@ -20,15 +20,15 @@
except:
pass
try:
- raise error,"something"
+ raise error("something")
except:
pass
try:
- raise error,"something"
+ raise error("something")
except:
pass
try:
- raise error,"something"
+ raise error("something")
except:
pass
try:
Modified: python/branches/p3yk/Tools/pybench/Lookups.py
==============================================================================
--- python/branches/p3yk/Tools/pybench/Lookups.py (original)
+++ python/branches/p3yk/Tools/pybench/Lookups.py Sun Jan 14 00:54:39 2007
@@ -774,11 +774,11 @@
l.sort
l.sort
- d.has_key
- d.has_key
- d.has_key
- d.has_key
- d.has_key
+ # d.has_key
+ # d.has_key
+ # d.has_key
+ # d.has_key
+ # d.has_key
d.items
d.items
@@ -810,11 +810,11 @@
l.sort
l.sort
- d.has_key
- d.has_key
- d.has_key
- d.has_key
- d.has_key
+ # d.has_key
+ # d.has_key
+ # d.has_key
+ # d.has_key
+ # d.has_key
d.items
d.items
@@ -846,11 +846,11 @@
l.sort
l.sort
- d.has_key
- d.has_key
- d.has_key
- d.has_key
- d.has_key
+ # d.has_key
+ # d.has_key
+ # d.has_key
+ # d.has_key
+ # d.has_key
d.items
d.items
@@ -882,11 +882,11 @@
l.sort
l.sort
- d.has_key
- d.has_key
- d.has_key
- d.has_key
- d.has_key
+ # d.has_key
+ # d.has_key
+ # d.has_key
+ # d.has_key
+ # d.has_key
d.items
d.items
@@ -918,11 +918,11 @@
l.sort
l.sort
- d.has_key
- d.has_key
- d.has_key
- d.has_key
- d.has_key
+ # d.has_key
+ # d.has_key
+ # d.has_key
+ # d.has_key
+ # d.has_key
d.items
d.items
More information about the Python-3000-checkins
mailing list