Computer Science question (python list is slow with my cruddy algorithm )

Paul Rubin phr-n2002b at NOSPAMnightsong.com
Fri Aug 23 05:54:11 EDT 2002


"Mr. Neutron" <nicktsocanos at charter.net> writes:
> 	The problem is though just to generate the statement
> 		MyList = [ [0] * 32767 for i in range(32767) ]
> 
> 	Takes forever (well, it seems like forever).

Your problem isn't the algorithm.  You are almost certainly running
out of memory and your machine is thrashing its brains out.  That
array uses around 4 GB of memory.

Look at the array module (included in the distribution) and the
Numeric module (google for "numeric python").  And make your array
smaller if you can.  



More information about the Python-list mailing list