[Python-Dev] python compiler

Craig Citro craigcitro at gmail.com
Mon Apr 5 19:32:11 CEST 2010


> I hate to remind you but Cython is *not* python. It does not even plan
> to support all of the parts which are considered python semantics
> (like tracebacks and frames).
>

It's true -- we basically compile to C + the Python/C API, depending
on CPython being around for runtime support, and I don't see that
changing anytime soon. (I don't think I tried to claim that we were a
full Python implementation in my original email ...) I'm curious about
the bit you mention, though -- is constructing a call frame for every
Python call really part of the semantics, and not just a CPython
implementation detail? (I've never played with Jython or IronPython to
know if they do this.) We actually *do* construct all the call frames
when doing profiling, so we could turn this on if we needed to for a
"strict" mode, but usually the additional runtime speedup is more
desirable.

Independent of this, the OP was asking about working on something as
part of a school-related project. I think that if you're looking to
see how a Python to C compiler works, you could get quite a bit from
checking out Cython and/or Pyrex, even if your real goal was to create
a Python implementation independent of CPython.

-cc


More information about the Python-Dev mailing list