Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

speed.py fixes #184

Merged
merged 2 commits into from

2 participants

@geekless

This fixes the following error:

Traceback (most recent call last):
  File "samples/speed/speed.py", line 81, in 
    Tester().test()
  File "samples/speed/speed.py", line 75, in test
    print "Python version := \"%i.%i.%i %s %i\"" % sys.version_info
TypeError: %d format: a number is required, not sys.version_info

and also makes it run on python 3.

@stevedekorte stevedekorte merged commit d2105a2 into from
@stevedekorte

Thanks geekless

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 12 additions and 8 deletions.
  1. +12 −8 samples/speed/speed.py
View
20 samples/speed/speed.py
@@ -3,6 +3,10 @@
oneMillion = 1000000
+if sys.version_info >= (3,):
+ def xrange(v):
+ return range(int(v))
+
class Tester:
def foo(self):
return 1
@@ -12,7 +16,7 @@ def beginTimer(self):
def endTimer(self, s):
mps = 1/(time.time() - self.t1)
- print "Python %s := %0.2f" % (s, mps)
+ print("Python %s := %0.2f" % (s, mps))
def testSlot(self):
self.beginTimer()
@@ -61,21 +65,21 @@ def testSetLocals(self):
self.endTimer("localSets ")
def test(self):
- print ""
+ print("")
self.testLocals()
self.testSetLocals()
- print ""
+ print("")
self.testSlot()
self.testSetSlot()
- print ""
+ print("")
self.testBlock()
self.testInstantiations()
import sys
- print "Python version := \"%i.%i.%i %s %i\"" % sys.version_info
- print ""
- print "// values in millions per second"
- print ""
+ print("Python version := \"%i.%i.%i %s %i\"" % tuple(sys.version_info))
+ print("")
+ print("// values in millions per second")
+ print("")
Tester().test()
Something went wrong with that request. Please try again.