[Cython] How to define C-consts in python module scope

Robert Bradshaw robertwb at math.washington.edu
Mon Jul 18 20:30:59 CEST 2011


Trevor King and I discussed this quite a while back, but every time I
got around to looking at his code (I don't think he ever created a
formal pull request) something came up. The idea was that we could
support cpdef structs and extern functions as well.

On Mon, Jul 18, 2011 at 2:38 AM, Vitja Makarov <vitja.makarov at gmail.com> wrote:
> cdef enum:
>     EV_READ  = 1
>     EV_WRITE = 2
>
> Is there a way to put this constants into module dict?
> I want to access this constants from pure python code, I tried this way:
>
> globals()['EV_READ'] = EV_READ
> globals()['EV_WRITE'] = EV_WRITE
>
> But I don't like it, is there any other way?
>
> --
> vitja.
> _______________________________________________
> cython-devel mailing list
> cython-devel at python.org
> http://mail.python.org/mailman/listinfo/cython-devel
>


More information about the cython-devel mailing list