On Jul 30, 2008, at 10:46 , [EMAIL PROTECTED] wrote:
Of course I can just build those lists naively by creating copies of
the original list and then sorting them according to my wishes. But
that would create huge memory overhead.
If the list itself is not memory intensive, but only the objects,
then you shouldn't have to worry. For example,
In [1]:big_object=[0.0]*int(1e7) # about 40 meg
In [2]:big_object2=[0.0]*int(1e7) # another 40 meg
In [3]:list1=[big_object,big_object2] # maybe a few bytes more, but
no copy
In [4]:list2=[big_object2,big_object] # maybe a few bytes more, but
no copy
after this, my python process takes about 80 meg. names like
big_object are just names, and they reference an object in memory.
if you say a=big_object, you are saying that the name "a" should also
reference that same object.
bb
--
Brian Blais
[EMAIL PROTECTED]
http://web.bryant.edu/~bblais
--
http://mail.python.org/mailman/listinfo/python-list