When one decides to start learning the programming language python, A question may arise he/she firstly stumble is to learn which version of Python. The ever so powerful & disciplined Python 2 or the potential and growing Python 3 ? In this blog We’ll try to find out the answer..
What’s the difference between Python 2 and Python 3 ? Or more specifically Python 2.7 and 3.3. (Since those appear to be the main versions in debate.)
Instead of trying to answer this questions myself (a newbie in the world of Python), I decided to turn to the experts AKA the internet. So, let the great debate begin! Sarcasm…it’s not too much of a fiery debate.
PYTHON 2 VS. PYTHON 3: OVERALL PICTURE
wiki.python.org goes into depth on the differences between Python 2.7 and 3.3, saying that there are benefits to each. It really depends on what your are trying to achieve. But, in summation: “Python 2.x is legacy, Python 3.x is the present and future of the language.”
There are subtle differences between the two. But the biggest difference is the print statement.
WHAT’S DIFFERENT ABOUT THE PRINT STATEMENT?
Taken from a discussion on Stack Overflow,
“The most visible (difference) is probably the way the “print” statement works. It’s different enough that the same script won’t be able to run on both versions at the same time, but pick one and you’ll be fine.“
A similar view from the Twitterverse:
Essentially, the print statement has been replaced with a print () function.
IMPORTANT: PYTHON 2 HAS LIBRARIES
So beyond this difference in the print statement, across the web I see lots of mention to the library support in 2.7:
This article on medium mentioned in the Tweet above and titled “Python 3 is killing Python”, has a lot of information which will help you taking a desicion. Stephen A. Goss, is very passionate about not moving to Python 3 and keeping Python 2 alive. He also points to 3rd party libraries as one of Python 2’s greatest strengths.
In this talk Brett Cannon, who works for Python, is all about Python 3.3. He admits off the bat he has an obvious bias. But still has enough to say to fill up a forty minute talk. Here the video’s link:
Beyond the guy’s opinion who works for Python, across the internet I was stumbling upon similar sentiments that I think are expressed well from a discussion I found on Quora:
“The main advantage of 3.x is that it is on the cutting edge, so all the new features will be implemented in there rather than being added to 2.x. The other thing you may want to consider is that it is the common python of the future, so looking a couple of years down the line, this will be the mature branch that people go to.”
And people who’ve moved from Python 2 to 3 have liked it too!! Checkout this survey
AS A BEGINNER, WHICH SHOULD I LEARN?
I’m sure if you’re a beginner, like me, you’re thinking: “Umm cool. But which should I learn?” Because when you’re new to programming, you’re still trying to wrap your head around a function. Not deeply analyze the subtleties between versions of the same language.
Found in the same Stack Overflow discussion mentioned earlier, (however, this time from a different commenter ):
“Python 3 is a nicer and more consistent language, BUT, there is very limited third-party module support for it. This is likely to be true for at least a couple of years more. So, all major frameworks still run on Python 2, and will continue to do so for a significant time. Therefore, if you learn Python today, you should learn Python 2, because that is the version you are going to end up actually using.”
At the same time, one could certainly start off learning Python 3.3. It is where the language is heading, anyways.
However, I do believe it is wise to start off with 2.7 as a beginner for the main reason that there is far more documentation to help you along the way. Plus computers (well, at least my Mac OS X) come with Python 2.7 built in already. So you don’t have to go out and download 3.3.
Python 2 or Python 3 — Which should a newbie learn!?
CONCLUSION: PYTHON 2 IS THE WINNER…FOR NOW
For now I will continue learning with 2.7. It seems like the differences between 2x and 3x are relatively minor. My main goal is to just learn a programming language — I don’t want to get caught up in the minor variations between the two versions.
Besides, it seems like both are acceptable.
##Stay in touch for the next post on Python.