[Pyrex] anonymous enums - I need an idea

Simon Burton simon at arrowtheory.com
Sat Feb 25 06:44:40 CET 2006


On Thu, 23 Feb 2006 18:43:58 +0100 (CET)
Helmut Jarausch <jarausch at skynet.be> wrote:

> 
> cdef extern from "estraier.h" :
> 
>   int  ESTCONDSURE                  # check every N-gram key 
>   int  ESTCONDUSUAL                 # check N-gram keys skipping by one 
> 
> 
> Is there an elegant solution to making this values available in my
> Python code (outside the Pyrex code) or do I need to construct a
> dictionary within my Pyrex code which holds all these values like
> 
> Codes= { 'CONSURE':ESTCONDSURE, 'CONDUSUAL': ESTCONDUSUAL }

What about this:

cdef extern from "estraier.h":
  enum:
    c_ESTCONDSURE "ESTCONDSURE"

ESTCONDSURE = c_ESTCONDSURE # set a python variable


Simon.

-- 
Simon Burton, B.Sc.
Licensed PO Box 8066
ANU Canberra 2601
Australia
Ph. 61 02 6249 6940
http://arrowtheory.com 



More information about the Pyrex mailing list