News for hackers. Stuff that matters.
Re:Pycraft: Minecraft engine in Python by squeaky-clean on Tuesday April 19, 2016 @10:42AM (#11527308)
That doesn't tell you about the speed of the code though.

    $> python -m timeit "1 <= 4 <= 5"
    10000000 loops, best of 3: 0.0877 usec per loop
    
    $> python -m timeit "4 in range(1,5)"
    1000000 loops, best of 3: 0.413 usec per loop

    $> python -m timeit "4 in (1,2,3,4,5)"
    10000000 loops, best of 3: 0.0776 usec per loop
Tested in python 3.5.0, Even with the improvements to the range function, the comparison is almost 5x faster.

There are no comments on this comment yet.