b))) return a + b ... def noisey_save(s): print("save called with args: {args}".format(args=(s,))) # /dev/null is web scale with open('/dev/null', 'w') as f: f.write(s) noisey_add(1, 2) noisey_save('Important Data') add called with args: (1, 2) save called with args: ('Important Data',)
that prints arguments to a function before calling it." name = f.__name__ @wraps(f) def print_then_call_f(*args): print("{f} called with args: {args}".format(f=name, args=args)) return f(*args) return print_then_call_f
@noisey def save(s): # Still web scale with open('/dev/null', 'w') as f: f.write(s) add(1, 2) save("Important Data") add called with args: (1, 2) save called with args: ('Important Data',)
the pyxl encoding from pytenn2016.pyxl import hello_html hello_html() <pyxl.html.x_html at 0x7f65c435b470> str(hello_html()) '<html><body>Hello World!</body></html>'
Python Factorial: 100000 loops, best of 3: 3.43 µs per loop Cython Factorial: The slowest run took 254.86 times longer than the fastest. This could mean that an intermediate result is being cached. 10000000 loops, best of 3: 44.4 ns per loop
print("\nNumba Factorial:") %timeit numbafact(25) Python Factorial: 100000 loops, best of 3: 3.21 µs per loop Cython Factorial: 10000000 loops, best of 3: 42.6 ns per loop Numba Factorial: The slowest run took 20.38 times longer than the fastest. This could mean that a n intermediate result is being cached. 10000000 loops, best of 3: 148 ns per loop