Ask HN: Where to learn Python 3 for an experienced Python 2 programmer?

3 points by candidtim ↗ HN
For an experienced Python 2 programmer, what are the resources to learn what's new in Python 3, and how to program in idiomatic Python 3 way? There are numerous python tutorials out there, but it seems that most of them are either for a beginner Python programmer, starting from the basics, or quite superficial, or focus on migration and compatibility only. Are there documents covering specifically Python 3 new features? I have in mind something in the spirit of what https://babeljs.io/learn-es2015/ does for ECMAScript 5, for example.

Thank you!

2 comments

[ 5.4 ms ] story [ 19.1 ms ] thread
Not much to learn.

To get your scripts working (basically):

- Strings vs bytes (i.e. the reason for v3)

- Parenthesis for print

Some libraries have been changed a little. Personally, urllib has been the one, I have had the most trouble with.

As for the new features. Look at the release-notes which most of the time as pep numbers. Read the peps.

Some keyword could be: - generators

- iterators

- the "format string" string (prefixed with f)

But it is far from a new language... (Just an incompatible on with the one you know, primarily about strings).

Also: use “from __future__ import print_function” to start experimenting with that in older 2.x code. I have found the “bytearray” type (available in both 2.x and 3.x) can be a good way to write mostly the same code for both versions that can start to transition to raw bytes where needed.