Why doesn't Python 3 support backward compatibility?

I found out that Python 3 does not support backward compatibility.

Will this affect many applications using older versions of Python?

How did Python 3 developers not think it was absolutely necessary to make it backward compatible?

+46
python backwards-compatibility
Jan 30 '12 at 16:12
source share
1 answer

Is Python 3.0 backward compatible and why?

Python 3.0 implements many very useful features and breaks backward compatibility. He does this on purpose, so great features can be implemented even though Python 2.x code may not work correctly in Python 3.x.

So basically, Python 3.0 does not support backward compatibility . Thanks to this you can take advantage of a completely new set of functions. It is even called "Python 3000" or "Python 3K."

From "What's New in Python 3.0" (available here ):

Python 3.0 compared to 2.6. Python 3.0, also known as โ€œPython 3000โ€ or โ€œPy3K,โ€ is the first intentionally backward incompatible release of Python in history . There are more changes than the typical release, and much more, which is important for all Python users. However, after digesting the changes, you will find that Python has not really changed all of this - basically, well-known irritations and warts were mostly fixed and many old jerks were removed .

Python implements new versions 3.0 that eliminate backward compatibility

Some of the most notable features that may be considered a backward compatibility violation, but at the same time improving the language, are as follows:

  • print now a function, not an operator, and using it as an operator will result in an error,
  • various functions and methods now return an iterator or view instead of a list, which makes iterating according to their results more efficient in terms of memory (you do not need to store the entire list of results in memory),
  • cmp argument for sorting functions like sorted() and list.sort() no longer supported and should be replaced with the key argument,
  • int now matches Python 2.x long , which makes number processing less complicated. Operator
  • / now the operator for true division by default (you can use // to separate sexes)
  • text in Python 3.x is now Unicode by default,
  • True , False and None now reserved words (so you cannot do True, False = False, True ,
  • the use of the metaclass has changed,
  • exceptions must be BaseException from BaseException , BaseException and caught differently than in Python 2.x,
  • and much more, which makes Python more readable, consistent and explicit,
+40
Jan 30 '12 at 16:15
source share



All Articles