Sunday, 13 September 2015

Python2 VS Python3

The main differences are:

Brackets in print statements

Python2

Python3

Unicode

Python2 has ASCII strings but no byte
Python3 has Unicode with byte and bytearrays

Raising exceptions

Where Python 2 accepts both notations, the 'old' and the 'new' syntax, Python 3 chokes (and raises a syntax error in turn) if we don't enclose the exception argument in parentheses.
And so on..we have many to go in depth for the analysis between the two versions.

Thus similarly, we have slight change with some of the syntax and some are fixed.Mostly the new beginners to python are recommended to go with Python3 which is the future of the language :)


No comments:

Post a Comment