Antoine Pitrou <pit...@free.fr> added the comment: > Updated to use ABCs but still relies on user objects implementing > __sizeof__. So it is accurate whenever sys.getsizeof() is accurate.
I'm really -1 on this. It's better to give no measurement than to give a totally wrong indication. The fact that you had to special-case containers shows that getsizeof() is *not* the right solution for this. (because if it was, you could rely on the containers' __sizeof__ instead of overriding it) The "size of an object and its contents" generally doesn't make any sense, because the object graph is massively connected. getsizeof() gives you the basic internal footprint of the object, but that's all. It's really not a high-level tool for the everyday programmer, and relying on it to say how much memory would be saved by getting rid of certain objects is bogus. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue10725> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com