[Pyrex] A simple question: rephrased

Greg Ewing greg.ewing at canterbury.ac.nz
Wed Apr 18 22:33:43 UTC 2007


Alain Pointdexter wrote:

> But how do you access those constants defined in   pyrex file FROM PYTHON.

Oh, I see. For now, you need to assign them to
module-level Python variables. You may need
to do a bit of name jiggling in the process,
e.g.

   cdef extern from "somefile.h":
     cdef enum:
       c_const1 "const1"
       c_const2 "const2"

const1 = c_const1
const2 = c_const2

I hope to think of a better way of doing this
one day.

--
Greg



More information about the Pyrex mailing list