Why not a Python compiler?

Luis M. González luismgz at gmail.com
Wed Feb 6 00:43:37 CET 2008


On 5 feb, 05:19, Santiago  Romero <srom... at gmail.com> wrote:
>  ( Surely if this question has been asked for a zillion of times... )
>  ( and sorry for my english! )
>
>  I'm impressed with python. I'm very happy with the language and I
> find Python+Pygame a very powerful and productive way of writing 2D
> games. I'm not, at this moment, worried about execution speed of the
> small game I'm working on (it runs at full 60 fps even in an old AMD-
> K6 450 Laptop computer), but I continue asking me the same question:
>
>  Why not a Python COMPILER?
>
>  It would be very nice to be able to output Linux, MAC or Windows
> binaries of compiled (not bytecompiled) code. It would run faster, it
> will be smaller in size (I think) and it will be easy to distribute to
> people not having python installed. Yes, I know about py2exe, but I'm
> not sure if that's the right aproach.
>
>  So, what's wrong with compiling python?
>
>  Maybe is not possible due to nature of the language? Is just a
> decision?
>
>  What do you think about this?


There are some projects aimed to speed up Python by a large margin.
Right now you can use psyco, which is considered to be feature
complete, and whose future relies on the Pypy project.

Pypy is a very ambitious project and it aims, amongst many other
goals, to provide a fast just-in-time python implementation.
They even say that the "secret goal is being faster than c, which is
nonsense, isn´t it?" (I still didn´t get the joke though...).

And finally, you have ShedSkin, a project developed by one lonely and
heroic coder (Mark Dufour).
Shedskin aims at being a static python compiler, which can translate a
subset of python to stand alone executables.
It also can compile extension modules for cpython.
It works by translating python to c++ and then to machine code.
The python code must be done in a static way (getting rid of dynamic
features like, for example, not asigning different types to the same
variable).

Luis



More information about the Python-list mailing list