Execution speed question

Iain King iainking at gmail.com
Fri Jul 25 11:42:19 EDT 2008


On Jul 25, 4:22 pm, Matthew Fitzgibbons <eles... at nienna.org> wrote:
> It seems like the probability calculation applies to all three equally,
> and can therefore be ignored for the simulations.

The probability affects (1) more.  My reasoning for this being:  as
probability gets lower the number of times you have to loop over the
list increases.  (1) always loops over the full list, but with each
successive iteration (2) and (3) are looping over smaller and smaller
lists.  In the end this adds up, with (1) becoming slower than (2),
even though it starts out quicker.

Iain



More information about the Python-list mailing list