Message163008
| 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". |
|