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


Groups > comp.lang.python > #63261

Re: "More About Unicode in Python 2 and 3"

Date 2014-01-05 18:23 -0800
From Ethan Furman <ethan@stoneleaf.us>
Subject Re: "More About Unicode in Python 2 and 3"
References <lablra$1mc$2@ger.gmane.org> <labmaj$8u2$1@ger.gmane.org> <lad05k$gf6$1@ger.gmane.org> <CAPTjJmqBeoTLxXiKVcsvk395qgKt+Qv+jF_sOpzi7CgZmBjQcw@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.5000.1388976376.18130.python-list@python.org> (permalink)

Show all headers | View raw


On 01/05/2014 05:48 PM, Chris Angelico wrote:
> On Mon, Jan 6, 2014 at 12:16 PM, Ned Batchelder <ned@nedbatchelder.com> wrote:
>> So now we have two revered developers vocally having trouble with Python 3.
>> You can dismiss their concerns as niche because it's only network
>> programming, but that would be a mistake.
>
> IMO, network programming (at least on the internet) is even more Py3's
> domain (pun not intended).

The issue is not how to handle text, the issue is how to handle ascii when it's in a bytes object.

Using my own project [1] as a reference:  good ol' dbf files -- character fields, numeric fields, logic fields, time 
fields, and of course the metadata that describes these fields and the dbf as a whole.  The character fields I turn into 
unicode, no sweat.  The metadata fields are simple ascii, and in Py2 something like `if header[FIELD_TYPE] == 'C'` did 
the job just fine.  In Py3 that compares an int (67) to the unicode letter 'C' and returns False.  For me this is simply 
a major annoyance, but I only have a handful of places where I have to deal with this.  Dealing with protocols where 
bytes is the norm and embedded ascii is prevalent -- well, I can easily imagine the nightmare.

The most unfortunate aspect is that even if we did "fix" it in 3.5, it wouldn't help any body who has to support 
multiple versions... unless, of course, a backport could also be made.

--
~Ethan~

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


Thread

Re: "More About Unicode in Python 2 and 3" Ethan Furman <ethan@stoneleaf.us> - 2014-01-05 18:23 -0800
  Re: "More About Unicode in Python 2 and 3" Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-01-07 03:43 +1100
    Re: "More About Unicode in Python 2 and 3" Chris Angelico <rosuav@gmail.com> - 2014-01-07 03:54 +1100
    Re: "More About Unicode in Python 2 and 3" Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-01-06 17:07 +0000
    Re: "More About Unicode in Python 2 and 3" Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-01-06 19:23 -0500
    Re: "More About Unicode in Python 2 and 3" Chris Angelico <rosuav@gmail.com> - 2014-01-07 12:05 +1100

csiph-web