[Python-Dev] python compiler
Craig Citro
craigcitro at gmail.com
Mon Apr 5 17:31:54 CEST 2010
>> for a college project, I proposed to create a compiler for python. I've
>> read something about it and maybe I saw that made a bad choice. I hear
>> everyone's opinion respond.
>>
I don't think everyone thinks this is a bad idea -- for instance,
those of us working on Cython [1], which is itself a descendant of
Pyrex [2]. :)
> Python itself is a highly dynamic language and not amenable to direct
> compilation. Instead modern just-in-time compiler technology is seen as the
> way to improve Python performance. Projects that are doing this are PyPy and
> Unladen Swallow. A static subset of Python can be statically compiled,
> projects that do that include RPython (part of PyPy) and ShedSkin. These are
> not really Python though, just Python like languages that happen to be valid
> subsets of Python.
>
It's true that JIT compilation really opens up a whole world of
possibilities that Cython currently can't touch. On the other hand,
for some kinds of Python code -- especially, for example, things
related to scientific computing or mathematics -- Cython's a quick
road to massive speedups, because a little bit of static typing can go
a *long* way. It's true that Cython doesn't yet support the full
Python syntax, but this is considered a bug -- we're working hard on
being able to compile all of Python soon.
-cc
[1] http://www.cython.org/
[2] http://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/
More information about the Python-Dev
mailing list