Message163008
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". |
|
Date |
User |
Action |
Args |
2012-06-17 03:04:19 | eli.bendersky | set | recipients:
+ eli.bendersky, loewis, ncoghlan, Arfrever, flox, serhiy.storchaka |
2012-06-17 03:04:19 | eli.bendersky | set | messageid: <1339902259.29.0.894212451375.issue14055@psf.upfronthosting.co.za> |
2012-06-17 03:04:18 | eli.bendersky | link | issue14055 messages |
2012-06-17 03:04:17 | eli.bendersky | create | |
|