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

Paul Rubin phr-n2002b at
Fri Aug 23 11:54:11 CEST 2002

"Mr. Neutron" <nicktsocanos at> 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