Martin v. Löwis <[EMAIL PROTECTED]> added the comment:

It's actually not possible, in general, to compute the memory
consumption of an object using basicsize and itemsize. An example is the
dictionary, where there is no way to find out how many slots are
currently allocated.

Even for the things such as lists where the formula
basicsize+len*itemsize would be correct it may fail, e.g. a list reports
its itemsize as zero, even though each list item consumes four bytes (on
a 32-bit system).

I don't really see a problem with calling it sizeof, so I would then
propose sys.sizeof as the appropriate location.

----------
nosy: +loewis

__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue2898>
__________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to