How to turn a string into a list of integers?

Chris Angelico rosuav at
Sat Sep 6 14:23:20 CEST 2014

On Sat, Sep 6, 2014 at 10:15 PM, Kurt Mueller
<kurt.alfred.mueller at> wrote:
> I understand: narrow build is UCS2, wide build is UCS4
> - In a UCS2 build each character of an Unicode string uses 16 Bits and has
>   code points from U-0000..U-FFFF (0..65535)
> - In a UCS4 build each character of an Unicode string uses 32 Bits and has
>   code points from U-00000000..U-0010FFFF (0..1114111)

Pretty much. Narrow builds are buggy, so as much as possible, you want
to avoid using them. Ideally, use Python 3.3 or newer, where the
distinction doesn't exist - all builds are functionally like wide
builds, with memory usage even better than narrow builds (they'll use
8 bits per character if it's possible).

As a general rule, precompiled Python for Windows is usually a narrow
build, and Python distributions for Linux are usually wide builds. (I
don't know about Mac OS builds.) You can test any Python by checking
out sys.maxunicode - it'll be 65535 on a narrow build, or 1114111 on
wide builds (because that's the maximum codepoint defined by Unicode -
U+10FFFF - as it's the highest number that can be represented in


More information about the Python-list mailing list