Finding size of Variable

Mark Lawrence breamoreboy at yahoo.co.uk
Mon Feb 10 09:39:30 EST 2014


On 10/02/2014 14:25, Asaf Las wrote:
> 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?
>

Please don't feed this particular troll, he's spent 18 months driving us 
nuts with his nonsense.

-- 
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.

Mark Lawrence

---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com





More information about the Python-list mailing list