Logo

Programming-Idioms

History of Idiom 109 > diff from v10 to v11

Edit summary for version 11 by bukzor:
New Python implementation by user [bukzor]

Version 10

2016-11-09, 12:41:50

Version 11

2018-04-08, 19:02:43

Idiom #109 Number of bytes of a type

Set n to the number of bytes of a variable of type T.
This makes different sense (if any), depending on the language.

Idiom #109 Number of bytes of a type

Set n to the number of bytes of a variable of type T.
This makes different sense (if any), depending on the language.

Imports
import pympler.asizeof
Code
n = pympler.asizeof.asizeof(t)
Comments bubble
`pip install pympler` to get this third-party library. `sys.getsizeof` is built-in, but has many common failure modes.
Doc URL
http://pythonhosted.org/Pympler/asizeof.html#asizeof