Sunday, October 27, 2019

Which Version of python is good to learn

Now, in 2018, it’s more of a no-brainer: Python 3 is the clear winner for new learners

Bit of history

Python 2.0 was first released in 2000. Its latest version, 2.7, was released in 2010.
Python 3.0 was released in 2008. Its newest version, 3.6, was released in 2016, and version 3.7 is currently in development.
Although Python 2.7 is still widely used, Python 3 adoption is growing quickly. In 2016, 71.9% of projects used Python 2.7, but by 2017, it had fallen to 63.7%. This signals that the programming community is turning to Python 3–albeit gradually–when developing real-world applications.
Notably, on January 1, 2018, Python 2.7 will “retire” and no longer be maintained

Python2 vs Python 3

- Py2 is still in softwares of certain compnies while Py3 is going to take storm by 2020
- many older libs built for Py2 are not forward compatible. While many developers creating libs today are not backward compatible.
- strings are stored in ascii by default while stored as utf8 in py3
- floats are rounded to calculation to whole number, while it will be float itself in Py3
- py2 print statement is print "hello", in py3, it is print("hello")


Why to move to Py3?

- Py is traditionally a typed language by py3 support typing which removes development conflicts when working with new piece of code
- Py3 has faster runtime
- better community support

While Py2 still could be useful in below scenarios

- If you want to become a DevOps engineer and work with configuration management tools like Fabric or Ansible, you might have to work with both Python 2 and 3 (because parts of these libraries don’t have full Python 3 support).
- If your company has legacy code written in Python 2, you’ll need to learn to work with that.
- If you have a project that depends on certain third-party software or libraries that can't be ported to Python 3, you'll have no choice but to use Python 2 for it.

References:
https://learntocodewith.me/programming/python/python-2-vs-python-3/#history-of-python2-vs-3


No comments:

Post a Comment