Should I switch to Python 3 or continue with 2.7?




I am using python 2.7 for almost a year and i am comfortable with it now. Should I move to Python 3 as latest version always has better features and functionalities? Is there a lot changes in syntax or almost similar?




The normal advice, I give to people is that if you are new to Python, you can directly use Python 3.0. However, if you have been using Python 2.7 for some time, you will have challenges moving to Python 3.0. None of these are insurmountable challenges, but just things like format changes and different ways of doing things.

So, if you want to move, you will end up re-writing small parts of all your codes again. Also, there are a few libraries, which are not entirely available for 3.0 yet, so if you are used to using any niche libraries, it might be a good idea to check their availability in Python 3.0.

Specifically, here is a list of significant changes between Python 2.7 & 3.0 from top of my mind:

  1. print becomes a function in Python 3.0 so it has to carry the parenthesis around. It should be `print(). If you use iPython notebooks a lot or are used to performing a lot of interactive analysis, this might be a big pain.
  2. Division of integers: (int/int) returns an int in Python 2.7. In Python 3, (int/int) always returns a float, even if the result is a whole number. To get int result, you now need to use int//int .
  3. The raw_input() function in Python 2.7 is equivalent to input() in Python 3
  4. The range() function in Python 3.0 is like xrange() in Python 2.7, it does not return a list and can handle an arbitrarily large value

This is just the beginning. Here is the entire list of changes:

and here is a nice summary of it:

Overall, I think if you have been using Python 2.x for a year and don’t have any urgency to move to 3.0, you should continue. You can start writing your new projects in 3.0, if required, but it will create quite a bit of confusion until you are comfortable with the changes.



Python2.X’s support will be stopped in 2020 so it’s good to start with Python3 if you are starting out.


yes you can switch to python 3 because it is updated version of the python as compare to python version 2.7. the some changes are done in python 3.0 for example in python 2.7 the print statement has been replaced with a print () function.For example in Python 2.7 it is print “hello” but in Python 3 it is print (“hello”).