Is there a better way to solve this?

David Robinow drobinow at gmail.com
Mon May 23 16:27:58 EDT 2011


On Mon, May 23, 2011 at 2:55 PM, kracekumar ramaraju
<kracethekingmaker at gmail.com> wrote:
> You can use sizeof function,
>>>> a=12234
>>>> b=23456.8
>>>> a.__sizeof__()
> 12
>>>> b.__sizeof__()
> 16
> So sizeof int is 12 bytes and float is 16 bytes

I'm not sure what you're trying to show here, but try the following in
Python 3.2

>>> a = 9999
>>> for i in range(5):
...      a*= 100000
...      a.__sizeof__()
...



More information about the Python-list mailing list