Counting bytes

Martin von Loewis loewis at informatik.hu-berlin.de
Mon Feb 25 08:10:45 EST 2002


"Hugo Martires" <hmartires at cultalg.pt> 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.

Regards,
Martin




More information about the Python-list mailing list