Python 'for' loop is memory inefficient

r rt8396 at gmail.com
Sat Aug 15 04:01:26 CEST 2009


On Aug 14, 8:25 pm, "Dr. Phillip M. Feldman" <pfeld... at verizon.net>
wrote:
> I wrote the following correct but inefficient test of primality for purposes
> of demonstrating that the simplest algorithm is often not the most
> efficient.  But, when I try to run the following code with a value of n that
> is large enough to produce a significant amount of running time, I get an
> out-of-memory error!

I don't think Python was created to keep mathematician's happy.
Although strangely enough, the creator holds a masters degree in
mathematics *and* computer science. Just another one of life's little
ironies ;)



More information about the Python-list mailing list