How to turn a string into a list of integers?

Chris Angelico rosuav at gmail.com
Mon Sep 8 01:53:05 EDT 2014


On Mon, Sep 8, 2014 at 3:44 PM, Marko Rauhamaa <marko at pacujo.net> wrote:
> Chris Angelico <rosuav at gmail.com>:
>
>> The original question was regarding storage - how PEP 393 says that
>> strings will be encoded in memory in any of three ways (Latin-1,
>> UCS-2/UTF-16, or UCS-4/UTF-32). But even in our world, that is not
>> what a string *is*, but only what it is made of.
>
> I'm a bit surprised that kind of CPython implementation detail would go
> into a PEP. I had thought PEPs codified Python independently of CPython.
>
> But maybe CPython is to Python what England is to the UK: even the
> government is having a hard time making a distinction.

It is a bit of a tricky one. The PEP governs things about the API that
CPython offers to extensions, so it's part of the public face of the
language - it's not "purely an implementation detail" like, say, the
exact algorithm for expanding a list's capacity as elements get
appended to it.

ChrisA



More information about the Python-list mailing list