Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #70318
| References | (1 earlier) <mailman.9259.1397504710.18130.python-list@python.org> <lijtva$or1$1@speranza.aioe.org> <ee1d5f7d-efc5-4be2-9b41-a1e6118eb039@googlegroups.com> <lik2qa$640$1@speranza.aioe.org> <534df041$0$29993$c3e8da3$5496439d@news.astraweb.com> |
|---|---|
| Date | 2014-04-16 16:14 +1000 |
| Subject | Re: Martijn Faassen: The Call of Python 2.8 |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.9313.1397628890.18130.python-list@python.org> (permalink) |
On Wed, Apr 16, 2014 at 12:51 PM, Steven D'Aprano <steve+comp.lang.python@pearwood.info> wrote: > Converting "print spam" to "print(spam)" is the trivial part of it. The > biggest change between Python 2.x and 3.x is the bytes to Unicode shift, > and that is *not trivial*. Python 2.x tries very hard to make bytes and > strings interoperate even when doing so is the wrong thing to do. So > there is a lot of Python 2 code that is *broken* with respect to strings, > but *seems okay* so long as you only test it using pure ASCII. Python 3 > no longer tries to hide the difference, it forces you to confront the > fact that bytes and strings are not the same. To people raised on ASCII- > only programming standards, that's a huge paradigm shift, and a confusing > one. There's a lot to learn, a lot of pain if you don't learn it, and > there can be a lot of effort needed to migrate string code to Python 3. Has anyone ever had the same "oh great, now I have to push everyone through a paradigm shift" feeling about anything else? The only one I can think of is shifting my whole family off Windows file sharing (just accessing files everywhere) onto wholesale use of source control (have a local copy, and push your changes). > (Depending on what your code actually does. It is remarkable just how > much string code you can write that works identically in 2.x and 3.x. > Basic string handling remains basic in both.) With PEP 461 (slated for 3.5), that's going to get even easier. Not only will a simple double-quoted string "do the right thing" on both platforms, but both b"binary" and u"unicode" will support the same percent-formatting as well. But you do have to limit your definition of "2.x"; a lot of that commonality is the result of deliberate design, and NOT just "oh hey look it works", which means that 2.4 and 3.4 are very different. I respect and do not envy those who have to support both RHEL and Arch... ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: Martijn Faassen: The Call of Python 2.8 Phil Dobbin <phildobbin@gmail.com> - 2014-04-14 20:32 +0100
Re: Martijn Faassen: The Call of Python 2.8 Mark H Harris <harrismh777@gmail.com> - 2014-04-15 13:32 -0500
Re: Martijn Faassen: The Call of Python 2.8 Novocastrian_Nomad <gregory.j.baker@gmail.com> - 2014-04-15 12:37 -0700
Re: Martijn Faassen: The Call of Python 2.8 Mark H Harris <harrismh777@gmail.com> - 2014-04-15 14:54 -0500
Re: Martijn Faassen: The Call of Python 2.8 Terry Reedy <tjreedy@udel.edu> - 2014-04-15 17:02 -0400
Re: Martijn Faassen: The Call of Python 2.8 Mark H Harris <harrismh777@gmail.com> - 2014-04-15 17:17 -0500
Re: Martijn Faassen: The Call of Python 2.8 Ned Batchelder <ned@nedbatchelder.com> - 2014-04-15 17:03 -0400
Re: Martijn Faassen: The Call of Python 2.8 Andrew Berg <aberg010@my.hennepintech.edu> - 2014-04-15 16:38 -0500
Re: Martijn Faassen: The Call of Python 2.8 Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-04-16 02:51 +0000
Re: Martijn Faassen: The Call of Python 2.8 Chris Angelico <rosuav@gmail.com> - 2014-04-16 16:14 +1000
Re: Martijn Faassen: The Call of Python 2.8 Terry Reedy <tjreedy@udel.edu> - 2014-04-15 15:37 -0400
csiph-web