Key differences between Python 2 and 3 with examples
Chris Angelico
rosuav at gmail.com
Mon May 8 04:26:51 EDT 2017
On Mon, May 8, 2017 at 5:57 PM, Steven D'Aprano <steve at pearwood.info> wrote:
> And no, it's not just that Python 3 is The Future[1] and Python 2 is The
> Past.
>
>
> http://sebastianraschka.com/Articles/2014_python_2_3_key_diff.html
>
Error in page:
print('Python', python_version())
print('strings are now utf-8 \u03BCnico\u0394é!')
Python 3.4.1
strings are now utf-8 μnicoΔé!
This is *not* UTF-8. This is Unicode. The difference may seem trivial,
but it's one of the things that causes confusion when people try to
encode and decode strings.
Otherwise fairly accurate, with the caveat that a lot of what's been
removed from Py3 was already the non-recommended way as of 2.7 (eg
"raise Exception, message" or "except Exception, exc"). Well-written
modern Py2 code shouldn't see these as problems, but if you're porting
an old codebase, you'll need to cope with these things.
ChrisA
More information about the Python-list
mailing list