Created
July 29, 2014 17:57
-
-
Save mjpieters/1b2c5b13536265e338ac to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [1]: from random import randint | |
In [2]: lines = [randint(0, 42) for _ in range(10000)] | |
In [3]: %%timeit | |
...: for _ in lines[::-1]: pass | |
...: | |
10000 loops, best of 3: 149 µs per loop | |
In [4]: %%timeit | |
for _ in reversed(lines): pass | |
...: | |
10000 loops, best of 3: 120 µs per loop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment