[Python-Dev] python compiler

Guido van Rossum guido at python.org
Mon Apr 5 20:03:30 CEST 2010


On Mon, Apr 5, 2010 at 8:49 AM, Maciej Fijalkowski <fijall at gmail.com> wrote:
>> 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).

On Mon, Apr 5, 2010 at 10:32 AM, Craig Citro <craigcitro at gmail.com> wrote:
> 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 ...)

There has been some contentious debate about this in the past, where a
Cython developer(s?) insisted Cython be listed among the "Python
implementations" somewhere, on a par with IronPython, Jython and PyPy.
This does not seem the right place to list Cython to me. (Much though
I admire Cython's accomplishments!)

Insofar as the OP asked about "a compiler for Python" and you pointed
to Cython as an example, your post could easily be misunderstood as an
attempt to reopen that debate.

> 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.

Beign able to access call frames via tracebacks is certainly part of
the standard semantics, and a proper Python implementation should go
through great lengths to get this interface right (as IronPython,
Jython and PyPy indeed do).

> 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.

-- 
--Guido van Rossum (python.org/~guido)


More information about the Python-Dev mailing list