Message290536
Not including the Python accessible referred-to objects is consistent with how sys.getsizeof() works elsewhere (i.e. for object instances, the size of __dict__ is not included).
>>> import sys
>>> class A:
pass
>>> a = A()
>>> sys.getsizeof(a)
56
>>> sys.getsizeof(a.__dict__)
112
The result is easily misleading but this seems to have been an early design decision about the semanatics __sizeof__. |
|
Date |
User |
Action |
Args |
2017-03-26 16:02:43 | rhettinger | set | recipients:
+ rhettinger, loewis, pitrou, benjamin.peterson, serhiy.storchaka |
2017-03-26 16:02:43 | rhettinger | set | messageid: <1490544163.31.0.764435638456.issue12414@psf.upfronthosting.co.za> |
2017-03-26 16:02:43 | rhettinger | link | issue12414 messages |
2017-03-26 16:02:43 | rhettinger | create | |
|