python2和python3语法兼容吗_python3和python2兼容性选择

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年左右,它也将看到一个向后不兼容的变化。在

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值