Raymond Hettinger added the comment:
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__.
----------
nosy: +pitrou
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue12414>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com