Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #77567

Re: How to turn a string into a list of integers?

References (1 earlier) <mailman.13738.1409748804.18130.python-list@python.org> <1amjdb-p3n.ln1@chris.zbmc.eu> <CAN1F8qX+snaj5HF40KmFq4UqV6AziDEkCxLTH64O7PoctkB4vA@mail.gmail.com> <CAPTjJmoU9n7O2s059dyzZuFUuwO6G9toKaD8R+4OrUCJqV1-iw@mail.gmail.com> <CALwzidkZCS6vho4vY1nwmFDmQDJdCehC9K+k0+5eH5g=9vmfgQ@mail.gmail.com>
Date 2014-09-05 12:15 +1000
Subject Re: How to turn a string into a list of integers?
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.13779.1409883321.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Fri, Sep 5, 2014 at 12:09 PM, Ian Kelly <ian.g.kelly@gmail.com> wrote:
> On Thu, Sep 4, 2014 at 6:12 PM, Chris Angelico <rosuav@gmail.com> wrote:
>> If it's a Unicode string (which is the default in Python 3), all
>> Unicode characters will work correctly.
>
> Assuming the library that needs this is expecting codepoints and will
> accept integers greater than 255.

They're still valid integers. It's just that someone might not know
how to work with them. Everyone has limits - I don't think repr()
would like to be fed Graham's Number, for instance, but we still say
that it accepts integers :)

>> If it's a byte string (the
>> default in Python 2), then you can't actually have any Unicode
>> characters in it at all, you have bytes; Py2 lets you be a bit sloppy
>> with the ASCII range, but technically, you still have bytes, not
>> characters..
>
> In that case the library will almost certainly accept it, but could be
> expecting a different encoding.

Yeah. Either way, the problem isn't "be careful about Unicode
characters". One option has Unicode characters, the other doesn't, and
you need to know which one it is.

I just don't like people talking about "Unicode characters" being
somehow different from "normal text" or something, and being something
that you need to be careful of. It's not that there are some
characters that behave nicely, and then other ones ("Unicode" ones)
that don't.

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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