本文介绍了关于PyPy请告诉我的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好!


我一直在阅读有关PyPy的内容,但有些事情我不会理解它。我希望我能在这个

新闻组中获得一些启示。


首先,介绍:


< ;摘录>

" PyPy项目旨在生成灵活,快速的Python

实现。指导思想是将Python语言本身的Python级别的b $ b描述转换为较低级别的语言。

< / excerpt>


所以基本的想法是PyPy是Python中Python的实现

(即:用Python编写Python的解释器),然后翻译它

到另一种语言,如C或Java?它与

CPython或Jython有何不同呢?


此外,翻译是什么?这意味着什么翻译,例如,使用

Jython将PyPy翻译成Java类?或者使用Psyco翻译

PyPy到本地执行官?


< excerpt>

谣言有它这个秘密目标比C更快,这是无意义的,不是吗?

< / excerpt>


如果它被翻译成C,为什么这应该是无稽之谈?我是
意思是,PyPy与CPython的C版本都在C中,那为什么这个

应该是胡说八道?


似乎我在翻译这个词中错过了很多细微差别

这里。


此外,这一个:


< excerpt>

我们用Python编写了一个Python解释器,没有很多引用

到底层细节。 (由于Python的本质,这已经是复杂的任务了,虽然不如写入它 - 比如说 - C.)

然后我们用这个作为语言规范并操纵它来生成我们想要的更传统的口译员。在上面的

意义上,我们正在生成具体的映射。将Python改为

低级目标平台。

< / excerpt>


所以语言规范在本段_is_ Python中的Python

实现,a.k.a。:PyPy?然后是什么操纵它

来产生更传统的解释者是什么意思?


我的意思是,从我读到的内容来看,PyPy更多的是关于翻译器

将Python代码翻译成其他东西而不是

在Python中实现Python。在那种情况下,它可能是任何其他项目,对吗?如在Python中实现X,然后

翻译成另一种语言?


感谢您的任何指示!

Hello!

I''ve been reading about PyPy, but there are some things that I don''t
understand about it. I hope I can get some enlightenment in this
newsgroup :)

First, the intro:

<excerpt>
"The PyPy project aims at producing a flexible and fast Python
implementation. The guiding idea is to translate a Python-level
description of the Python language itself to lower level languages."
</excerpt>

So the basic idea is that PyPy is an implementation of Python in Python
(i.e.: writing Python''s interpreter in Python), and then translate that
into another language such as C or Java? How is it different from
CPython or Jython then?

Also, what does "translation" here mean? Translation as in, say, "Use
Jython to translate PyPy to Java classes"? Or "Use Psyco to translate
PyPy to native exec"?

<excerpt>
"Rumors have it that the secret goal is being faster-than-C which is
nonsense, isn''t it?"
</excerpt>

Why is this supposed to be nonsense if it''s been translated to C? I
mean, C version of PyPy vs. CPython, both are in C, then why is this
supposed to be nonsense?

It seems that I''m missing a lot of nuances in the word "translation"
here.

Also, this one:

<excerpt>
We have written a Python interpreter in Python, without many references
to low-level details. (Because of the nature of Python, this is already
a complicated task, although not as much as writing it in - say - C.)
Then we use this as a "language specification" and manipulate it to
produce the more traditional interpreters that we want. In the above
sense, we are generating the concrete "mappings" of Python into
lower-level target platforms.
</excerpt>

So the "language specification" in this paragraph _is_ the Python
implementation in Python, a.k.a.: PyPy? Then what does "manipulate it
to produce the more traditional interpreters" mean?

I mean, it seems from what I read that PyPy is more about a translator
that translates Python code into something else rather than
implementing Python in Python. In that case, it could have been any
other project, right? As in implementing X in Python, and then
translate to another language?

Thanks for any pointers!

推荐答案









因为那时你必须用C维护它。这样,一旦你有了

第一个工作翻译你可以把它翻译成C来提高它的b / b
性能,用它来翻译* next * working translator,和

等等。因此,您的维护工作是在Python代码上完成的,而不是手工翻译的C.


相当标准的自举技术,虽然它有时很难

来理解在X中编写语言X的编译器所涉及的问题

。典型的是m版本的编译器必须以版本(m-1)编写
,例如:-)


used-to -do-that-for-a-living-ly y''rs - 史蒂夫

-

Steve Holden +44 150 684 7255 +1 800 494 3119

Holden Web LLC

PyCon TX 2006


Because then you''d have to maintain it in C. This way, once you have the
first working translator you can translate it into C to improve its
performance, and use it to translate the *next* working translator, and
so on. Consequently your maintenance work is done on the Python code
rather than hand-translated C.

Fairly standard bootstrapping technique, though it''s sometimes difficult
to appreciate the problems involved in writing a compiler for language X
in X itself. Typical is the fact that the compiler for version m has to
be written in version (m-1), for example :-)

used-to-do-that-stuff-for-a-living-ly y''rs - steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006 www.python.org/pycon/


这篇关于关于PyPy请告诉我的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-01 19:03