Pyrex - The speed of Python with the clarity of C?

Terry Reedy tjreedy at udel.edu
Sat May 22 00:39:14 EDT 2004


<SeeBelow at SeeBelow.Nut> wrote in message news:40AE9A5E.8F514E3B at shaw.ca...
> Terry Reedy wrote:
> >
> > "Peter Hansen" <peter at engcorp.com> wrote in message
> > news:juidnTjQubr1szPd4p2dnA at powergate.ca...
> > > SeeBelow at SeeBelow.Nut wrote:
> > > > Am I wrong about this?  Perhaps I don't understand how Pyrex works.
> > >
> > > Look at the primes.pyx example.  There's a link just below it
> > > (above the Language Details section) showing the C code it is
> > > compiled to (and which is in turn compiled to machine code).

To repeat: 'and which is in turn compiled to machine code'.

> > In particular, lines 5-15 of the Python code, the 'guts' of the
algorithm,
> > are compiled to pure C with no interface calls.
>
> But does this C code get compiled into machine code?

I don't understand why you are asking this again when Peter answered so
clearly.  As you said in your first post, there would otherwise be no point
to the translation to C.

> If so, What compiler does that, and when?

Better question.  I do not have PyRex, so I do not know the details.
Either PyRex call a C compiler itself, automatically, or it leave the C
file for you to invoke the compiler.  Or perhaps it gives you a choice.
*nix systems come with a C compiler.  The location should be part of the
system data somewhere.  On other systems, you might have to buy one and
give PyRex the name and location.  PyRex is an alternative to writing C
code yourself, but not, I believe, an alternative to having a C compiler.

Terry J. Reedy







More information about the Python-list mailing list