Different between Python 2 and Python 3? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 16

Different between Python 2 and Python 3?

8th Feb 2017, 3:54 AM
Giorgi R.
Giorgi R. - avatar
11 Réponses
+ 5
2.7 will never be upgraded to 2.8, but still benefits of 3.x development with module 'future' wich is designed ( and uodated ) to help progressive migration from 2.x to major version upgrade 3.x, as a lot of development still is based on 2.x, due to the wide park of application running on those versions, and the lack of modules ported to 3.x available... Anyway, the few differences are enough to become hard to upgrade big project from 2.x to 3.x, but not too many to learn/practice the two major versions at same time ( and you should prefer, because for medium and long term future you need know 3.x, but for short and medium term job ( or script/project sharing ) market you need to know 2.x ^^ )
8th Feb 2017, 10:26 AM
visph
visph - avatar
+ 8
There are some syntax differences between Python 2 and Python 3.0. Namely the print built-in became a proper function, we got dictionary and set comprehensions and in later versions of Python 3 a whole host of asynchronous libraries and supporting syntax was added.
8th Feb 2017, 4:07 AM
James Durand
James Durand - avatar
+ 4
Also Python 2.x is no longer receiving support or updates from the Python Foundation.
8th Feb 2017, 4:07 AM
James Durand
James Durand - avatar
+ 4
Joke Python 3-Python 2=1 That's the difference
14th Feb 2017, 7:24 AM
Daniel Fernandes
Daniel Fernandes - avatar
+ 3
Also an important change in the way of coding : python 2 uses 'statements', as instance : print "Hello" Although python 3 only uses 'fonctions'. Former statements have been converted so in built-in functions, like this one : print("hello") This simplification makes the code easier to understand and to run I think, with only one type of object to manipulate. EDIT : I mean : if, else... are still statements, but the definition of statements is now much closer to the behavior of the langage itself.
8th Feb 2017, 3:58 PM
Mira
+ 3
It worth mentioning that in Python 3.x all strings are unicode, unless stated otherwise. Also, I think the interpreter has no problem with unicode, so that you can have variables and function-names written in non-English characters. It's a huge improvement.
12th Feb 2017, 7:12 PM
Torbjørn
Torbjørn - avatar
+ 2
Python 2 is more reliable and less prone to errors but Python 3 has more features.
9th Feb 2017, 4:36 AM
Kishan Takoordyal
Kishan Takoordyal - avatar
+ 2
now I can see the clear picture!
9th Feb 2017, 10:05 AM
Kaustav
Kaustav - avatar
+ 2
I wrote a quiz submission: the differences I found, from following sololearn course are: brackets to invoke print (not in 2.*) divide by zero (I forget, I submitted it weeks ago but there was a difference)
11th Feb 2017, 8:00 PM
Leon
Leon - avatar
0
i think , you should use python 3 because python 2 is old and python 3 has new rules (excuse me , i am new learning english)
9th Feb 2017, 8:16 PM
Cemre Acar
Cemre Acar - avatar
0
Mostly syntax differences. But one thing. Most tutorials you find in python is in python2.7 version. Anyway, python has developed some new codes and replced some with the lod ones. ex:-print tag in pyhon 2.7 print is not followed by brackets to the output. But in python 3 this is extremly compulsory. raw_input tag in python 2.7 raw_input tag is the only tag for input but in python 3 this is removed and replaced with input()
10th Feb 2017, 6:42 AM
Pasindu Nirmal Silva
Pasindu Nirmal Silva - avatar