Hi!

Szabolcs Berecz schrieb:
> On 4/12/06, Michael Yanowitz <[EMAIL PROTECTED]> wrote:
> > 2) Efficiency. It is alot quicker to code something in Python. If I can
> >    write it in Python and auto-convert it to C++. I would save time coding.
>
> I don't think you will get a more efficient code. The reason is the
> extremely dynamic nature of python. Almost everything is done at
> runtime. I think one goal of PyPy is to automatically infer the types
> of variable, but I don't think they have reached that point, yet. One
> project you can consider is the psycho python package which generates
> specialized native code at the price of high memory consumption.

PyPy can infer the types of variables - but not of any Python program.
Also the C code that is the result is quite a bit more efficient
(currently around a factor of 300 or so), but it works only for a
restricted subset of Python (which is called RPython in PyPy jargon).
PyPy can translate not only to C, but also to LLVM. Backends for
Smalltalk, the CLI and Javascript are being worked on.

> > 3) Education. I would learn more about Python, C++, their similarities and
> > differences.
>
> I don't think so. Higher level languages translated to C are not very
> readable (or at least that's what I have seen)

The result of a PyPy translation is definitively _not_ readable :-).

> > 4) Other. Just want to know how well Language translators work these days. I
> > have seen
> >    Fortran2C and Pascal2C translators in the past. Would like to see how
> > well these
> >    work with Python.
>
> Than I think PyPy is the way to go. I have heard about another project
> with the goal of translating python to high efficiency C++ code but
> forgot the url. Anybody?

It is not the goal of PyPy to be a generally useful Python to C (or to
anything else) translator. The translator is just a side-product of how
PyPy bootstraps its interpreter (which is written in RPython). The
result might be somewhat useable for other stuff too, but it was never
meant to work for a general Python program.

Cheers,

Carl Friedrich Bolz

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to