This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eli.bendersky
Recipients Arfrever, eli.bendersky, flox, loewis, ncoghlan, serhiy.storchaka
Date 2012-06-17.03:04:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1339902259.29.0.894212451375.issue14055@psf.upfronthosting.co.za>
In-reply-to
Content
Martin, thanks for the explanation. The patch LGTM, then.

Could it be useful to document this a bit more explicitly in the description of sys.getsizeof? The most intuitive thing to expect from it is to compute the *total* size including contained objects. So this is somewhat surprising:

>>> import sys
>>> sys.getsizeof([1, 2, 3])
96
>>> sys.getsizeof([1, 2, [10] * 500])
96

The last sentence in the doc of sys.getsizeof says: "See recursive sizeof recipe for an example of using getsizeof() recursively to find the size of containers and all their contents.", which can be taken as a hint, but maybe it could be just said straightforwardly. I.e before it, add: "Note that getsizeof returns just the memory occupied by the object itself, not any contained objects it holds references to".
History
Date User Action Args
2012-06-17 03:04:19eli.benderskysetrecipients: + eli.bendersky, loewis, ncoghlan, Arfrever, flox, serhiy.storchaka
2012-06-17 03:04:19eli.benderskysetmessageid: <1339902259.29.0.894212451375.issue14055@psf.upfronthosting.co.za>
2012-06-17 03:04:18eli.benderskylinkissue14055 messages
2012-06-17 03:04:17eli.benderskycreate