10

I will be giving a small course on the Python programming language to a group of interns this summer. As I am sure you know, there are many different versions of the Python language.

I am wondering what to consider when choosing a particular version of the Python programming language. Is choosing the latest version of Python always the correct decision?

Tom
  • 203
  • 1
  • 8

1 Answers1

19

A few years ago, the answer to this would have been "stick with Python 2; the libraries aren't ready for Python 3 yet". In many cases, that would have been a deal-breaker, because many of the older libraries were pretty useful, particularly for scientific computation.

However, the story's a bit different now, in 2017. There isn't much of a reason to stick with Python 2; almost all of the top 360 libraries support it now.

A few popular resources, like Learn Python the Hard Way, have remained ardently Python 2-only until recently (early 2017), and I suspect a lot of old tutorials haven't been updated.

If you stay with Python 2, you miss out on all of the really nice features, like async and f-strings, which have only been added to the 3.x series.

Something to consider, though: Python 2 and 3 are very similar, and learning one will mean you can relatively easily switch to the other. Python 3 just removes the major 'gotchas', like 5 / 2 = 2, or bad things happening when you use Unicode. For beginners, I think it's a great advantage for things to work intuitively (until, of course, you fight with the floating point representation issue).

Generally, I don't think you'll experience any problems with Python 3, and it seems logical to me to learn the future of the language, rather than Python 2, which is legacy.

Aurora0001
  • 3,506
  • 14
  • 43
  • 7
    Second this. Used to use Python 2 because Pygame wasn't available for 3. Now that it is, no reason to look back. – Ryan Nutt May 23 '17 at 19:06
  • 1
    The only reason to look into Python 2 is if you are working with some library or package that is created in it. Otherwise, I 100% agree with @Aurora001 – Ben I. May 23 '17 at 19:18
  • at this time web mining libraries like pattern (https://pypi.python.org/pypi/Pattern) still stick with python2. Their py3 version still at testing stage – geomars May 23 '17 at 23:48
  • 1
    Also keep in mind that -as noted in [PEP-373](https://www.python.org/dev/peps/pep-0373/)- in [2020](https://pythonclock.org/) Python 2.X will be retired... – quobit Jun 13 '17 at 10:03