[pypy-commit] pypy virtual-arguments: a **kwargs pypyjit_demo
cfbolz
noreply at buildbot.pypy.org
Mon Apr 16 11:46:42 CEST 2012
Author: Carl Friedrich Bolz <cfbolz at gmx.de>
Branch: virtual-arguments
Changeset: r54402:6a77563ee515
Date: 2012-04-14 12:15 +0200
http://bitbucket.org/pypy/pypy/changeset/6a77563ee515/
Log: a **kwargs pypyjit_demo
diff --git a/pypy/jit/tl/pypyjit_demo.py b/pypy/jit/tl/pypyjit_demo.py
--- a/pypy/jit/tl/pypyjit_demo.py
+++ b/pypy/jit/tl/pypyjit_demo.py
@@ -1,19 +1,27 @@
import pypyjit
pypyjit.set_param(threshold=200)
+kwargs = {"z": 1}
-def g(*args):
- return len(args)
+def f(*args, **kwargs):
+ result = g(1, *args, **kwargs)
+ return result + 2
-def f(n):
- s = 0
- for i in range(n):
- l = [i, n, 2]
- s += g(*l)
- return s
+def g(x, y, z=2):
+ return x - y + z
+
+def main():
+ res = 0
+ i = 0
+ while i < 10000:
+ res = f(res, z=i)
+ g(1, res, **kwargs)
+ i += 1
+ return res
+
try:
- print f(301)
+ print main()
except Exception, e:
print "Exception: ", type(e)
More information about the pypy-commit
mailing list