chunking a long string?

Chris Angelico rosuav at
Fri Nov 8 21:53:10 CET 2013

On Sat, Nov 9, 2013 at 7:43 AM,  <wxjmfauth at> 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)
>>> sys.getsizeof(True)

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)



More information about the Python-list mailing list