"More About Unicode in Python 2 and 3"

Chris Angelico rosuav at gmail.com
Sun Jan 5 20:48:03 EST 2014


On Mon, Jan 6, 2014 at 12:16 PM, Ned Batchelder <ned at 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).

1) The internet is global. You WILL come across other languages, other
scripts, everything.

2) In most cases, everything is clearly either text or binary, and
usually text has an associated (and very clear) encoding (eg HTTP
headers). If it's not explicitly given, the RFCs will often stipulate
what the encoding should be. It's pretty easy, you don't have to go
"Is this Latin-1? Maybe CP-1252? Could it be something else?".

3) The likelihood is high that you'll be working with someone else's
code at the other end. Ties in with #2 - this is why the specs are so
carefully written. Getting these things right is incredibly important.

If I'm writing something that might have to work with anything from
anywhere, I want a system that catches potential errors earlier rather
than later. I don't want to write interpolated SQL that works
perfectly until Mr O'Hara tries to sign up (or, worse, young Robert
whose sister is named "Help I'm trapped in a driver's license
factory"); I want to get it right from the start. Yes, that means more
work to get "Hello, World" going. Yes, it means that I need to get my
head around stuff that I didn't think I'd have to. (One time I
implemented Oauth manually rather than using a library - the immediate
reason was some kind of issue with the library, but I was glad I did,
because it meant I actually understood what was going on; came in
handy about two weeks later when the far end had a protocol problem.)

Most of the complaints about Py3 are "it's harder to get something
started (or port from Py2)". My answer is that it's easier to get
something finished.

ChrisA



More information about the Python-list mailing list