chunking a long string?

Mark Lawrence breamoreboy at yahoo.co.uk
Fri Nov 8 16:06:17 EST 2013


On 08/11/2013 20:53, Chris Angelico wrote:
> On Sat, Nov 9, 2013 at 7:43 AM,  <wxjmfauth at gmail.com> wrote:
>> Oops, sorry, I'm wrong, it can be much more.
>>
>>>>> sys.getsizeof('ab')
>> 27
>>>>> sys.getsizeof('a\U0001d11e')
>> 48
>>>>>
>
> I know, overhead sucks doesn't it. Python is really abysmal at that;
> look how big a single bit is:
>
>>>> sys.getsizeof(1)
> 14
>>>> sys.getsizeof(True)
> 14
>
> On the flip side, Python gets really awesome at some other things.
> Your operating system probably takes an entire CD to distribute, maybe
> even a DVD, so that's either 700MB or 4.7GB, give or take. Look how
> efficiently Python can represent it:
>
>>>> sys.getsizeof(os)
> 36
>
> Wow!
>
> ChrisA
>

Those figures look really good but I actually want figures that do 
things my way, even if the figures aren't as good or even suck 
completely.  Can you help me with this even if I've already asked 42 
times before but have always been given the same figures in response?

-- 
Python is the second best programming language in the world.
But the best has yet to be invented.  Christian Tismer

Mark Lawrence




More information about the Python-list mailing list