[issue19048] itertools.tee doesn't have a __sizeof__ method

Antoine Pitrou report at bugs.python.org
Thu Sep 19 20:17:46 CEST 2013


Antoine Pitrou added the comment:

Here is why using get_referents() is stupid in the general case:

>>> class C: pass
... 
>>> c = C()
>>> gc.get_referents(c)
[<class '__main__.C'>]

With your method, measuring c's memory consumption also includes the memory consumption of its type object.
(and of course this is only a trivial example... one can only imagine what kind of mess it is with a non-trivial object)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19048>
_______________________________________


More information about the Python-bugs-list mailing list