Finding size of Variable

Asaf Las roegltd at gmail.com
Mon Feb 10 09:25:16 EST 2014


On Monday, February 10, 2014 4:07:14 PM UTC+2, wxjm... at gmail.com wrote:
Interesting 

> >>> sys.getsizeof('a' * 1000000)
here you get string type 

> >>> sys.getsizeof(('a' * 1000000 + 'oe' + '\U00010000').encode('utf-8'))
and here bytes

>>> type ('a' * 10000)
<class 'str'>
>>> type(('a' * 1000000 + 'oe' + '\U00010000').encode('utf-8'))
<class 'bytes'>
>>>

Why? 



More information about the Python-list mailing list