On Tue, Nov 22, 2016 at 1:06 PM, BartC <b...@freeuk.com> wrote: >> In this specific example, the OP is comparing two radically different >> pieces of code that clearly and obviously perform differently. He's doing >> the equivalent of timing the code with his heartbeat, and getting 50 beats >> for one and 150 beats for the other. That's good enough to show gross >> differences in performance. > > No, he's using time.clock() with, presumably, a consistent number of ticks > per second.
Note that some people in this discussion use Unix systems, on which using time.clock for wall-clock timing is completely wrong. Please use timeit.default_timer to ensure that examples are portable. -- https://mail.python.org/mailman/listinfo/python-list