关于Python和CPython (Jython,IronPython)有什么大惊小怪的,我不明白:
python.org提到CPython是:
Python的“传统”实现(昵称为CPython)
还有一个Stack Overflow问题提到:
CPython是Python的默认字节码解释器,Python是用C语言编写的。
老实说,我不明白这两个解释实际上意味着什么,但我想的是,如果我使用CPython,这是否意味着当我运行一个示例python代码时,它会将其编译为C语言,然后像执行C代码一样执行
那么到底什么是CPython,它与python相比有什么不同,我应该使用CPython而不是python,如果是的话,它的优点是什么?
Cpython是Python的默认实现,当我们从它的官方网站下载Python时,它就会出现在我们的系统中。
Cpython将扩展名为.py的python源代码文件编译为一个中间字节码,该字节码通常被赋予.pyc扩展名,并由Cpython虚拟机执行。Python的这种实现提供了与Python包和C扩展模块的最大兼容性。
还有许多其他的Python实现,如IronPython, Jython, PyPy, CPython, Stackless Python等等。
The original, and standard, implementation of Python is usually called CPython when
you want to contrast it with the other options (and just plain “Python” otherwise). This
name comes from the fact that it is coded in portable ANSI C language code. This is
the Python that you fetch from http://www.python.org, get with the ActivePython and
Enthought distributions, and have automatically on most Linux and Mac OS X machines.
If you’ve found a preinstalled version of Python on your machine, it’s probably
CPython, unless your company or organization is using Python in more specialized
ways.
除非你想用Python编写Java或。net应用程序的脚本,或者找到其中的好处
如果你不想使用Stackless或PyPy,你可能想使用标准的CPython系统。
因为它是该语言的参考实现,所以它倾向于运行
最快、最完整、比替代方案更新更及时、更健壮
系统。