I am missing the point why Python3 has commands are not compatible with Python2.
因为python3和python2不是同一种语言。在
Python版本通常与以前的版本向后兼容;python2.7与python2.6基本上是向后兼容的。在
然而,从一开始,python3(或3000作为它最初的设计项目的代号)就明显地不同于。引自one of the design documents:Python 3000 will introduce a number of backwards-incompatible changes to Python, mainly to streamline the language and to remove some previous design mistakes.)
因此,python3不能向后兼容,不能用向后兼容的更改来纠正语言中的特定错误。在
使用语句来写入stdout而不是函数就是其中的一个变化;print已被函数print()取代。在
不同的语言和软件项目对版本号的含义使用不同的标准。Python坚持主-次微模式;同一个主版本号内的版本在很大程度上是向后兼容的,同一个小版本号内的版本只包含错误修复。请参见Python version number FAQ:Python versions are numbered A.B.C or A.B. A is the major version number – it is only incremented for really major changes in the language. B is the minor version number, incremented for less earth-shattering changes. C is the micro-level – it is incremented for each bugfix release. See PEP 6 for more information about bugfix releases.
Python也比C要老很多。Python开发始于1989年,版本2.0于2000年问世。另一方面,C从2002年才出现;也许再过10年左右,它也将看到一个向后不兼容的变化。在