[Tutor] Memory error for list creation

Triantafyllos Gkikopoulos T.Gkikopoulos at dundee.ac.uk
Tue Aug 24 16:54:19 CEST 2010


Hi,
 
 I am looking for an alternative to:
 

************************************************************
Please consider the environment. Do you really need to print this email? 


 
>>> listx=[[[] for k in range(ds)] for j in range(i)]
 
as right now I am getting a Memory error on this, I tried this also on a cluster node with something like 16GB of memory and it didn't solve the problem.
 
listx is subsequently used:
 
>>> for x in something:
>>>      for y in x:
>>>                   listx[ii][y[1]].append(y[0])
>>>      ii+=1
 
 
 
 For reference values for k range from 300 -1200 and for i ~5000.
 
 
I though about using scipy/numpy array but then I wouldn't be able to have the flexibility of using append or not having to predefine the size.
 
 
 Thanks
 

The University of Dundee is a registered Scottish charity, No: SC015096
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100824/1b1a072c/attachment.html>


More information about the Tutor mailing list