Python 2 vs. Python 3

There are two main kinds of Python, called Python 2and Python 3.

Python 2 is an older version of the original Python. It’s development has since been intentionally stalled, although that doesn’t mean that there are no updates to it. On the contrary, the updates are issued on a regular basis, but they are not intended to modify the language in any significant way. They rather fix any freshly discovered bugs and security holes. Python 2’s development path has reached a dead end already, but Python 2 itself is still very much alive.

Python 3 is the newer (to be precise, the current) version of the language. It’s going through its own evolution path, creating its own standards and habits.

These two versions of Python aren’t compatible with each other. Python 2 scripts won’t run in a Python 3 environment and vice versa, so if you want the old Python 2 code to be run by a Python 3 interpreter, the only possible solution is to rewrite it, not from scratch, of course, as large parts of the code may remain untouched, but you do have to revise all the code to find all possible incompatibilities. Unfortunately, this process cannot be fully automatized.

It’s too hard, too time-consuming, too expensive, and too risky to migrate an old Python 2 application to a new platform. It’s possible that rewriting the code will introduce new bugs to it. It’s easier and more sensible to leave these systems alone and to improve the existing interpreter, instead of trying to work inside the already functioning source code.

Python 3 isn’t just a better version of Python 2 – it is a completely different language, although it’s very similar to its predecessor. When you look at them from a distance, they appear to be the same, but when you look closely, though, you notice a lot of differences.

If you’re modifying an old existing Python solution, then it’s highly likely that it was coded in Python 2. This is the reason why Python 2 is still in use. There are too many existing Python 2 applications to discard it altogether.

If you’re going to start a new Python project, you should use Python 3, and this is the version of Python that will be used during this course.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s