Python 3.0是向下兼容的,为什么?
Python 3.0实现了很多非常有用的功能,并打破了向后兼容性。它的目的是,所以伟大的功能可以实现,即使事实上Python 2.x代码可能无法正常工作在Python 3.x下。
所以,基本上,Python 3.0是不是向后兼容的目的。由于这一点,你可以受益于一整套全新的功能。它甚至被称为“Python 3000”或“Python 3K”。
从“Python 3.0的新功能”(可用here):
Python 3.0, compared to 2.6. Python 3.0, also known as “Python 3000” or “Py3K”, is the first ever intentionally backwards incompatible Python release. There are more changes than in a typical release, and more that are important for all Python users. Nevertheless, after digesting the changes, you’ll find that Python really hasn’t changed all that much – by and large, we’re mostly fixing well-known annoyances and warts, and removing a lot of old cruft.
Python在3.0中有新特性,打破了向下兼容性
一些可以被认为是破坏向后兼容性但是同时改进语言的最显着的特征是:
> print现在是一个函数,而不是一个语句,并且使用它作为语句会导致错误,>各种功能&方法现在返回一个迭代器或视图而