unicode memory usage

Gary Robinson grobinson at transpose.com
Wed Sep 3 16:13:07 CEST 2003

We have an application which involves storing a lot of strings in RAM. It
would be most convenient to use Unicode strings, but I am wary  of doubling
memory usage. My fear is based on the idea that unicode strings may take two
bytes per character in order to accomodate non-ascii characters.

But I don't know whether that's actually how Python strings work internally.

So, my question: Do unicode strings in Python take substantially more memory
than classic python strings or not, assuming the strings are generally 99%
ASCII characters (but not 100%)?


Putting http://wecanstopspam.org in your email helps it pass through
overzealous spam filters.

Gary Robinson
Transpose, LLC
grobinson at transpose.com

More information about the Python-list mailing list