开发者

Do alternate python implementation version numbers imply that they provide the same syntax?

for example Jython is at version 2.5.1, does that imply a parallel fidelity to cpython syntax when it was at version 2开发者_开发知识库.5.1?


Generally yes, but there's technically nothing stopping alternate implementations from choosing whatever version numbers they want.

It's also important to note that just because Jython 2.5.1 is intended to match CPython 2.5.1, doesn't mean that they're going to behave exactly the same or be entirely compatible -- consider C-based modules, for example, and facilities for getting at the underlying bytecode.

The lack of any real standards body or formal specification for the Python language means that there are no clear rules on what constitutes "Python" and what is "implementation defined".


That is correct, or very close. Jython and IronPython have changed their numbering scheme to match the CPython version whose features they most closely implement.


The syntax (and feature set) are controlled strictly by the first two numbers -- every 2.5.* is claiming to implement the same syntax and feature set (in terms of language definition, not of aspects the language-reference manual explicitly leaves up to the implementation: for example, both Jython and IronPython have 'buh' mean "a unicode string literal", while CPython has it mean "a byte string literal"). A higher *, within any line of implementation, implies bug fixes and/or optimizations which don't affect syntax and features (except for fixing implementation bugs that had happened at some lower *, if any).

So, Jython 2.5.1 may be substituted for any CPython 2.5.x for any value of x -- and it claims to be better than Jython 2.5 (IMHO shd be 2.5.0 but the trailing .0 is not used in practice), though not as good as Jython 2.5.2 if the latter exist. But it does not purport to emulate the bugs in CPython 2.5.1 that were fixed in CPython 2.5.2 or later: no doubt each implementation has its own bugs, and nobody claims bug-for-bug compatibility;-).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜