[Pyrex] anonymous enums - I need an idea

Helmut Jarausch jarausch at skynet.be
Thu Feb 23 18:43:58 CET 2006


Hi,

in the library I'm wrapping there are lots of
anonymous enums like
enum {                                   /* enumeration for options */
  ESTCONDSURE = 1 << 0,                  /* check every N-gram key */
  ESTCONDUSUAL = 1 << 1,                 /* check N-gram keys skipping by one */
  # and so on
};

In my Pyrex code I have defined theses simply as ints
within a 
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 }

Many thanks for a hint,


Helmut Jarausch

Lehrstuhl fuer Numerische Mathematik
RWTH - Aachen University
D 52056 Aachen, Germany



More information about the Pyrex mailing list