Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #77673
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder7.xlned.com!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'cpython': 0.05; 'mrab': 0.05; '64-bit': 0.07; 'encoded': 0.07; 'indexing': 0.07; 'smallest': 0.07; 'utf-8': 0.07; 'string': 0.09; '*is*': 0.09; 'bits': 0.09; 'latter': 0.09; 'subject:into': 0.09; 'subject:string': 0.09; 'whatever.': 0.09; 'subject:How': 0.10; 'cc:addr:python-list': 0.11; 'python': 0.11; 'suggest': 0.14; '128-bit': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'length.': 0.16; 'pointers.': 0.16; 'units,': 0.16; 'wrote:': 0.18; 'variable': 0.18; 'first.': 0.19; 'memory': 0.22; 'saying': 0.22; 'cc:addr:python.org': 0.22; 'bytes': 0.24; 'integer': 0.24; 'mon,': 0.24; 'cc:2**0': 0.24; 'header:In-Reply- To:1': 0.27; '[1]': 0.29; 'am,': 0.29; 'character': 0.29; '(like': 0.30; '[2]': 0.30; 'subject:list': 0.30; 'message- id:@mail.gmail.com': 0.30; 'largest': 0.30; 'gives': 0.31; 'are.': 0.31; 'bunch': 0.31; 'restricted': 0.31; 'sep': 0.31; 'steven': 0.31; 'probably': 0.32; "can't": 0.35; 'except': 0.35; 'definition': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'ram': 0.36; 'sequence': 0.36; 'subject:?': 0.36; 'should': 0.36; 'list': 0.37; 'represent': 0.38; 'rather': 0.38; 'either': 0.39; 'even': 0.60; 'most': 0.60; 'first': 0.61; 'name': 0.63; 'kind': 0.63; 'different': 0.65; 'characters,': 0.84; 'difference.': 0.84; 'packing': 0.84; 'to:none': 0.92 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=ExpVpia/EzUPvYazcGA7jV33jUGV65O3O0JhgUkR1+Y=; b=kqTCA1Zns54MmCkOivQOGzlX9algiZTRjNNKjmeGZ6YRwRazvCXfcno9zHdIFElKvM aaTDjtzrtDkhWyXJjuRWYPAMuabR0t45pD8dxfce3/P36uS3EkYzleF+YE9TcOmXTNSC D9UPdynYTfkgKSUysOJiijJ2mkWowE++y9lMeJJhkJsYjuAgACe4MUcv3jCDIp9p3IHP gM4pRE5o1HliSfb1R8h7GPXtYtgTepzzuLcoXx9jC4+cCCI5ZWHIY9zVjDbhnXnUBEzX x+AJc1MoIp2iL61sEcvyo0vQF14HKUeIa0dsiEqOn4hRX+H3XzCtfhGhgPgHs/x0Ks8c /owA== |
| MIME-Version | 1.0 |
| X-Received | by 10.43.94.73 with SMTP id bx9mr25670669icc.19.1410102274119; Sun, 07 Sep 2014 08:04:34 -0700 (PDT) |
| In-Reply-To | <540C712C.8000806@mrabarnett.plus.com> |
| References | <h2ejdb-mdk.ln1@chris.zbmc.eu> <mailman.13738.1409748804.18130.python-list@python.org> <1amjdb-p3n.ln1@chris.zbmc.eu> <mailman.13776.1409864831.18130.python-list@python.org> <1k9odb-1qs.ln1@chris.zbmc.eu> <mailman.13801.1409939785.18130.python-list@python.org> <540aa002$0$29968$c3e8da3$5496439d@news.astraweb.com> <mailman.13833.1410005730.18130.python-list@python.org> <540b504a$0$29974$c3e8da3$5496439d@news.astraweb.com> <mailman.13842.1410031704.18130.python-list@python.org> <540bb91c$0$29969$c3e8da3$5496439d@news.astraweb.com> <540C712C.8000806@mrabarnett.plus.com> |
| Date | Mon, 8 Sep 2014 01:04:34 +1000 |
| Subject | Re: How to turn a string into a list of integers? |
| From | Chris Angelico <rosuav@gmail.com> |
| Cc | "python-list@python.org" <python-list@python.org> |
| Content-Type | text/plain; charset=UTF-8 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.13850.1410102277.18130.python-list@python.org> (permalink) |
| Lines | 25 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1410102277 news.xs4all.nl 2910 [2001:888:2000:d::a6]:38438 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:77673 |
Show key headers only | View raw
On Mon, Sep 8, 2014 at 12:52 AM, MRAB <python@mrabarnett.plus.com> wrote: > I don't think you should be saying that it stores the string in Latin-1 > or UTF-16 because that might suggest that they are encoded. They aren't. Except that they are. RAM stores bytes [1], so by definition everything that's in memory is encoded. You can't store a list in memory; what you store is a set of bits which represent some metadata and a bunch of pointers. You can't store a non-integer in memory, so you use some kind of efficient packed system like IEEE 754. You can't even store an integer without using some kind of encoding, most likely by packing it into some number of bytes and laying those bytes out either smallest first or largest first. So yes, CPython 3.3 stores strings encoded Latin-1, UCS-2 [2], or UCS-4. The Python string *is* a sequence of characters, but it's *stored* as a sequence of bytes in one of those encodings. (And other Pythons may not use the same encodings. MicroPython uses UTF-8 internally, which gives it *very* different indexing performance.) ChrisA [1] On modern systems it stores larger units, probably 64-bit or 128-bit hunks, but whatever. Same difference. [2] As Steven says, UTF-16 or UCS-2. I prefer the latter name here; as it (like Latin-1) is restricted in character set rather than variable in length. But same thing.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How to turn a string into a list of integers? cl@isbd.net - 2014-09-03 13:27 +0100
Re: How to turn a string into a list of integers? Peter Otten <__peter__@web.de> - 2014-09-03 14:52 +0200
Re: How to turn a string into a list of integers? cl@isbd.net - 2014-09-03 15:48 +0100
Re: How to turn a string into a list of integers? Joshua Landau <joshua@landau.ws> - 2014-09-04 22:06 +0100
Re: How to turn a string into a list of integers? cl@isbd.net - 2014-09-05 09:42 +0100
Re: How to turn a string into a list of integers? Kurt Mueller <kurt.alfred.mueller@gmail.com> - 2014-09-05 19:56 +0200
Re: How to turn a string into a list of integers? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-09-06 15:47 +1000
Re: How to turn a string into a list of integers? Peter Otten <__peter__@web.de> - 2014-09-06 10:22 +0200
Re: How to turn a string into a list of integers? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-09-06 21:17 +1000
Re: How to turn a string into a list of integers? Kurt Mueller <kurt.alfred.mueller@gmail.com> - 2014-09-06 14:15 +0200
Re: How to turn a string into a list of integers? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-09-07 04:19 +1000
Re: How to turn a string into a list of integers? Kurt Mueller <kurt.alfred.mueller@gmail.com> - 2014-09-06 21:28 +0200
Re: How to turn a string into a list of integers? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-09-07 11:47 +1000
Re: How to turn a string into a list of integers? MRAB <python@mrabarnett.plus.com> - 2014-09-07 15:52 +0100
Re: How to turn a string into a list of integers? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-09-08 03:02 +1000
Re: How to turn a string into a list of integers? Rustom Mody <rustompmody@gmail.com> - 2014-09-07 10:53 -0700
Re: How to turn a string into a list of integers? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-09-08 04:08 +1000
Re: How to turn a string into a list of integers? Rustom Mody <rustompmody@gmail.com> - 2014-09-07 11:34 -0700
Re: How to turn a string into a list of integers? Chris Angelico <rosuav@gmail.com> - 2014-09-08 10:14 +1000
Re: How to turn a string into a list of integers? Marko Rauhamaa <marko@pacujo.net> - 2014-09-08 08:44 +0300
Re: How to turn a string into a list of integers? Chris Angelico <rosuav@gmail.com> - 2014-09-08 15:53 +1000
Re: How to turn a string into a list of integers? Terry Reedy <tjreedy@udel.edu> - 2014-09-08 03:41 -0400
Re: How to turn a string into a list of integers? Chris Angelico <rosuav@gmail.com> - 2014-09-08 01:04 +1000
Re: How to turn a string into a list of integers? Roy Smith <roy@panix.com> - 2014-09-07 11:40 -0400
Re: How to turn a string into a list of integers? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-09-08 04:00 +1000
Re: How to turn a string into a list of integers? Chris Angelico <rosuav@gmail.com> - 2014-09-08 10:12 +1000
Re: How to turn a string into a list of integers? Chris Angelico <rosuav@gmail.com> - 2014-09-06 22:23 +1000
Re: How to turn a string into a list of integers? Chris “Kwpolska” Warrick <kwpolska@gmail.com> - 2014-09-05 20:25 +0200
Re: How to turn a string into a list of integers? Kurt Mueller <kurt.alfred.mueller@gmail.com> - 2014-09-05 21:16 +0200
Re: How to turn a string into a list of integers? Kurt Mueller <kurt.alfred.mueller@gmail.com> - 2014-09-05 22:41 +0200
Re: How to turn a string into a list of integers? Chris Angelico <rosuav@gmail.com> - 2014-09-05 10:12 +1000
Re: How to turn a string into a list of integers? Ian Kelly <ian.g.kelly@gmail.com> - 2014-09-04 20:09 -0600
Re: How to turn a string into a list of integers? Chris Angelico <rosuav@gmail.com> - 2014-09-05 12:15 +1000
Re: How to turn a string into a list of integers? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-09-06 14:27 +1000
Re: How to turn a string into a list of integers? obedrios@gmail.com - 2014-09-03 07:30 -0700
csiph-web