Counting bytes

Martin von Loewis loewis at
Mon Feb 25 08:10:45 EST 2002

"Hugo Martires" <hmartires at> writes:

> How can i count the number of bytes of:
> --> List []
> --> array('d',[])
> There is any function that return's the number of bytes ?

For the list, no. For the array: len(arr.tostring()) will give a rough
estimate. The actual memory consumption is higher, due to Python and
malloc overheads.


More information about the Python-list mailing list