Skip to content

Commit e4d3349

Browse files
authored
Merge pull request #423 from cclauss/print_function
Use print() function in both Python 2 and 3
2 parents ea98bec + b01e631 commit e4d3349

File tree

7 files changed

+18
-11
lines changed

7 files changed

+18
-11
lines changed

benchmarks/expand2_sage.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
from __future__ import print_function
12
from timeit import default_timer as clock
23
from sage.all import var
34
var("x y z w")
45
e = (x+y+z+w)**15
56
f = e*(e+w)
6-
print f
7+
print(f)
78
t1 = clock()
89
g = f.expand()
910
t2 = clock()

benchmarks/expand3.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
from __future__ import print_function
12
import sys
23
sys.path.append("..")
34
from timeit import default_timer as clock
45
from symengine import var
56
var("x y z")
67
f = (x**y + y**z + z**x)**100
7-
print f
8+
print(f)
89
t1 = clock()
910
g = f.expand()
1011
t2 = clock()

benchmarks/expand3_sage.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
from __future__ import print_function
12
from timeit import default_timer as clock
23
from sage.all import var
34
var("x y z")
45
f = (x**y + y**z + z**x)**100
5-
print f
6+
print(f)
67
t1 = clock()
78
g = f.expand()
89
t2 = clock()
9-
print "Total time:", t2-t1, "s"
10+
print("Total time:", t2-t1, "s")

benchmarks/expand4_sage.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
print "import..."
1+
from __future__ import print_function
2+
print("import...")
23
from timeit import default_timer as clock
34
from sage.all import var
45
var("x")
56
e = 1
6-
print "constructing expression..."
7+
print("constructing expression...")
78
for i in range(1, 351):
89
e *= (i+x)**3
9-
print "running benchmark..."
10+
print("running benchmark...")
1011
t1 = clock()
1112
f = e.expand()
1213
t2 = clock()

benchmarks/expand5.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
from __future__ import print_function
12
import sys
23
sys.path.append("..")
34
from timeit import default_timer as clock
45
from symengine import var
56
var("x y z")
67
e = (x+y+z+1)**15
78
f = e*(e+1)
8-
print f
9+
print(f)
910
t1 = clock()
1011
g = f.expand()
1112
t2 = clock()

benchmarks/expand5_sage.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
from __future__ import print_function
12
from timeit import default_timer as clock
23
from sage.all import var
34
var("x y z")
45
e = (x+y+z+1)**15
56
f = e*(e+1)
6-
print f
7+
print(f)
78
t1 = clock()
89
g = f.expand()
910
t2 = clock()
10-
print "Total time:", t2-t1, "s"
11+
print("Total time:", t2-t1, "s")

benchmarks/kane.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from __future__ import print_function
12
import sys
23
sys.path.append("..")
34
from timeit import default_timer as clock
@@ -20,7 +21,7 @@
2021
t2 = clock()
2122
print("Total time:", t2-t1, "s")
2223

23-
print "SymPy diff:"
24+
print("SymPy diff:")
2425
t1 = clock()
2526
g = f.diff(sympy.Symbol("sq5"))
2627
t2 = clock()

0 commit comments

Comments
 (0)