Sion Arrowsmith wrote: > Santiago Romero <[EMAIL PROTECTED]> wrote: >> Is there a way to check the REAL size in memory of a python object? >> >> Something like >> >>> print sizeof(mylist) >> [ ... ] > > Would you care to precisely define "REAL size" first? Consider: > >>>> atuple = (1, 2) >>>> mylist = [(0, 0), atuple] > > Should sizeof(mylist) include sizeof(atuple) ? > >>>> del atuple > > What about now, when mylist has the only reference to the (1, 2) > object that also used to be referred to as atuple?
or add to the mix >>> mylist = [(0,0), atuple] * 1000 where the same atuple is referenced 1000 times. And then if you >>> del atuple defining "sizeof()" becomes even more peculiar if you have a thousand things that "have" the same item that nothing else claims ownership of. Or, if you have this: >>> alist = [1,2,3] >>> mylist = ['a', 'b', alist] * 10 >>> s1 = sizeof(mylist) >>> alist.append(42) >>> s2 = sizeof(mylist) should s1==s2 ? -tkc -- http://mail.python.org/mailman/listinfo/python-list