import pyperf runner = pyperf.Runner() runner.timeit(name="bench bool", stmt=""" for i in range(256): a = bool(i) """)