Eli Bendersky <eli...@gmail.com> added the comment: 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". ---------- nosy: +ncoghlan _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue14055> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com