I am still learning python and I started with Python 3. This question not Python 2 vs 3 or difference between them like print() is a function and not language construct and 3/2 = 1.5

My question is even if it is still python, what was the need of introduce something new which is not backward compatible, when -

  1. Syntax is the same
  2. Language philosophy is the same (import this)

Edit - Lets say all the popular packages are ported to Python 3, does that mean we no longer need Python 2

  • 1
    The language designers decided that Python 2 had inadequacies in its design that couldn't be fixed without breaking some things, and figured it was more important to clean up the design than to be backwards compatible. It has a Benevolent Dictator For Life at the helm (Guido van Rossum), and he can choose to do pretty much anything he wants with the language. – KChaloux Dec 6 '13 at 13:32
  • @gnat we have Python 3 because it solves those problems that's it?? – Mark Evans Dec 6 '13 at 13:33
  • @KChaloux please also take a look at edit i have made – Mark Evans Dec 6 '13 at 13:34
  • 2
    Regarding the edit, almost all languages have multiple versions. Older versions are frequently not completely compatible with newer versions. The old versions don't go away completely; they'll stick around in legacy applications. But new development is almost always done in the latest stable release of a programming language. – KChaloux Dec 6 '13 at 13:37
  • 1
    @MarkEvans "because it solves those problems that's it??" - yes, everyone would prefer backwards compatible improvements but when that's not possible you need to make backwards incompatible changes. – Simeon Visser Dec 6 '13 at 14:29

Python 3 was introduced to make improvements upon python 2, but I think what you are asking is why they are not backwards compatible. Basically, developers deliberately made python 3 not backwards compatible, for two main reasons:

  1. First of all, they wanted to change some things integral to python 2, and while the differences seemed small, the improvements that they had made would not have combined well with the existing structure. For example, the change to the "print" syntax you mentioned was made because print really is just calling a function, and really isn't a keyword in the same way that something like "if" or "while" is.

  2. The other reason backwards compatibility was severed was to keep python 2 and 3 separate. Some people, including me, prefer python 2.7 over python 3. Because python 3 made larger changes to the language, developers wanted to maintain the two versions almost as separate (if quite similar) languages.

For all intents and purposes, if you use python 2.7, the only difference that should really affect you is the change in "print".

| improve this answer | |

In a talk I heard Guido say something like this:

You do not want your library in the Python standard library. Once it is there you can not change the API if you made any mistake.

So a reason I want to add is:

  • Incompatible changes to the API can only be made between Major Python versions.


import SimpleHTTPServer
import CGIHTTPServer

changed to

import http.server
| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.