10
$\begingroup$

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?

$\endgroup$
19
$\begingroup$

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.

$\endgroup$
  • 7
    $\begingroup$ Second this. Used to use Python 2 because Pygame wasn't available for 3. Now that it is, no reason to look back. $\endgroup$ – Ryan Nutt May 23 '17 at 19:06
  • 1
    $\begingroup$ 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 $\endgroup$ – Ben I. May 23 '17 at 19:18
  • $\begingroup$ at this time web mining libraries like pattern (pypi.python.org/pypi/Pattern) still stick with python2. Their py3 version still at testing stage $\endgroup$ – geomars May 23 '17 at 23:48
  • 1
    $\begingroup$ Also keep in mind that -as noted in PEP-373- in 2020 Python 2.X will be retired... $\endgroup$ – quobit Jun 13 '17 at 10:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.