From ebb2a21a6500977494313bfda47b950f489acef7 Mon Sep 17 00:00:00 2001 From: Matheus Felipe <50463866+matheusfelipeog@users.noreply.github.com> Date: Mon, 22 Feb 2021 20:17:53 -0300 Subject: [PATCH 1/2] Upd of print func to py3 syntax --- docs/scenarios/speed.rst | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/scenarios/speed.rst b/docs/scenarios/speed.rst index e99b18f4e..e178efb63 100644 --- a/docs/scenarios/speed.rst +++ b/docs/scenarios/speed.rst @@ -176,17 +176,17 @@ What's the difference in speed? Let's try it! #primes implemented with Python import primes - print "Cython:" + print("Cython:") t1= time.time() - print primesCy.primes(500) + print(primesCy.primes(500)) t2= time.time() - print "Cython time: %s" %(t2-t1) - print "" - print "Python" + print("Cython time: %s" %(t2-t1)) + print("") + print("Python") t1= time.time() - print primes.primes(500) + print(primes.primes(500)) t2= time.time() - print "Python time: %s" %(t2-t1) + print("Python time: %s" %(t2-t1)) These lines both need a remark: From 727edfedf20c47e99c59f855a8366a336dc3b02b Mon Sep 17 00:00:00 2001 From: Dan Bader Date: Tue, 23 Feb 2021 09:10:29 -0800 Subject: [PATCH 2/2] Code formatting cleanup --- docs/scenarios/speed.rst | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/docs/scenarios/speed.rst b/docs/scenarios/speed.rst index e178efb63..5dc0cd845 100644 --- a/docs/scenarios/speed.rst +++ b/docs/scenarios/speed.rst @@ -168,25 +168,23 @@ What's the difference in speed? Let's try it! .. code-block:: python import time - #activate pyx compiler + # Activate pyx compiler import pyximport - pyximport.install() - #primes implemented with Cython - import primesCy - #primes implemented with Python - import primes + pyximport.install() + import primesCy # primes implemented with Cython + import primes # primes implemented with Python print("Cython:") - t1= time.time() + t1 = time.time() print(primesCy.primes(500)) - t2= time.time() - print("Cython time: %s" %(t2-t1)) + t2 = time.time() + print("Cython time: %s" % (t2 - t1)) print("") print("Python") - t1= time.time() + t1 = time.time() print(primes.primes(500)) - t2= time.time() - print("Python time: %s" %(t2-t1)) + t2 = time.time() + print("Python time: %s" % (t2 - t1)) These lines both need a remark: