Codementor Python expert and Stack Overflow legend Martijn Pieters joined us for an Office Hour session, in which he provided some informative opinions about several issues asked by our viewers.
As Martijn’s used Python 3.4 in his demo, one of the questions asked was whether if there is a good reason for Python beginners to move from 2.7 to 3.4
The text below is a summary done by the Codementor team and may vary from the original video and if you see any issues, please let us know!
Python 2.7 vs Python 3.4 ── What’s the difference and what should Python Beginners choose?
“This really depends on what third-party libraries you rely on.”
Personally, until Python 3.3 or 3.4, I would have stuck with Python 2.7, but I am now using Python 3.4 because of all the neat new features, and I think those changes will also make life easier for beginners. For example, the object-oriented path library and enumeration addition should be very helpful, and it’s not that difficult to switch over to Python 3. I think the Python developers have nailed the 3.x line, as it performs really well, and the interpreter uses history better than previous releases. Personally I really like the auto-completion features, which is why I used Python 3.4 in my demos. Moreover, Python 3.3. and 3.4 are getting all the developers’ attention, which means all the cool new additions are gathered in those versions, and they will be moving the ecosystem forward with the 3.x line. I believe 2.7 will be the last version for the 2.x series.
However, in Python 2.x a beginner won’t have to worry about all the implicit encoding and decoding issues that may arise when mixing byte strings and Unicode strings, so that may be something to consider.
The greatest difference between Python 2 and 3 is the libraries you use. If you are doing web development and use a lot of libraries that only support Python 2.x and have not yet been ported to Python 3.x, you might not have the same experience that makes Python so great.
In conclusion, beginners should have no problem switching over to Python 3, but if you are a beginner who depends on a lot of libraries that are 2.x only, then maybe it’s not such a great idea.
Other posts in this series with Martijn Pieters:
- Python Optimization and How it Can Affect Your Code
- 6 Useful Python Libraries Recommended by #1 Stack Overflow Answerer
- Martijn Pieters on the Future of Django
- Python Q&A with #1 Stack Overflow Python Expert
Need Martijn’s help? Book a 1-on-1 session!