On 18 July 2011 06:38, Vitja Makarov <vitja.maka...@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?
>

cdef public enum:
    EV_READ  = 1
    EV_WRITE = 2

However, I do not like it, because I would like to use "public" for
other meaning (API generation). Also note that using "public" will
trigger the generation of a header file.

Perhaps we should support "cpdef enum: ..."


-- 
Lisandro Dalcin
---------------
CIMEC (INTEC/CONICET-UNL)
Predio CONICET-Santa Fe
Colectora RN 168 Km 472, Paraje El Pozo
3000 Santa Fe, Argentina
Tel: +54-342-4511594 (ext 1011)
Tel/Fax: +54-342-4511169
_______________________________________________
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel

Reply via email to