On 5/23/2011 2:55 PM, kracekumar ramaraju wrote:
You can use sizeof function,

Appears not to be in manuals, that I could find. As a special method, it is intended to be called through sys.getsizeof.

a=12234
b=23456.8
a.__sizeof__()
12
b.__sizeof__()
16
So sizeof int is 12 bytes and float is 16 bytes

Depends on system. On my winxp machine, ints are 14 bytes.

>>> import sys
>>> size = sys.getsizeof
>>> size(1)
14
>>> size(1.0)
16
>>> size([])
36
>>> size([1,2,3])
48

--
Terry Jan Reedy

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to