Python 2 vs Python 3

Pavithra M
2 min readJan 19, 2022

Python 2 came out in 2000. The upgrade to the language was designed to make it easier for the average person to learn, but it also added many features developers needed, like list comprehension, Unicode support, garbage collection, and improved support for object-oriented programming. With all these benefits, it wasn’t a hard choice for developers to upgrade their Python 1 code to Python 2.

Python 3 came out in 2008 after van Rossum found new ways to improve the language. You learn as you go in programming, and sometimes problems only show up late in the process. But these improvements could only be made with a new version of Python that wouldn’t be backward compatible with Python 2.

What’s the difference between Python 2 and Python 3?

Python 3 brought many changes to the language, both large and small. For example, with Python 2, division between integers always returned another integer — so if you divided 7 by 5, you’d get 1. With Python 3, the same formula will return the actual value of 1.4 as a float.

Although, Python 2 is an old open source version here are where you still need to learn Python 2:

· To become a DevOps engineer and you need to work with configurations management tools like puppet or ansible. Here, you need to work with both of these versions.

· If your company’s code written in Python 2, you will require to learn to work with that

· If your development team is working on a project that depends on specific third-party libraries or software which you are not able to port to Python 3, then Python 2 is the only option available for you.

Here, are prime reasons for using Python 3.x versions:

· Python 3 supports modern techniques like AI, machine learning, and data science

· Python 3 is supported by a large Python developer’s community. Getting support is easy.

· Its easier to learn Python language compared to earlier versions.

· Offers Powerful toolkit and libraries

· Mixable with other languages

For detailed explanation : Python 2 vs Python 3

--

--