Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist
View pypycellmagic.py
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
import sys
import time
from subprocess import Popen, PIPE
 
def magic_pypy(line, cell):
cmd = ['pypy', '-c', cell]
tic = time.time()
p = Popen(cmd, stdout=PIPE, stderr=PIPE)
p.wait()
toc = time.time()
out,err = p.communicate()
if err:
print >> sys.stderr, err
print out
if '-t' in line:
print "time: %.3fs" % (toc - tic)
get_ipython().register_magic_function(magic_pypy, 'cell', 'pypy')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.