Deep version of sys.getsizeof [duplicate]

I think that Pympler has already beaten you to the punch on this one.

From their documentation:

>>> from pympler.asizeof import asizeof
>>> obj = [1, 2, (3, 4), 'text']
>>> asizeof(obj)
176

The source code can be found here.

Leave a Comment