[Pyrex] Shorthand for wrapping enums?

John J Lee jjl at pobox.com
Tue Jun 24 01:32:28 CEST 2003


I have a big enumeration:

cdef extern from "tidy.h":
...
    ctypedef enum TidyOptionId:
        TidyUnknownOption    # Unknown option!
        TidyIndentSpaces     # Indentation n spaces
        TidyWrapLen          # Wrap margin
        TidyTabSize          # Expand tabs to n spaces

        TidyCharEncoding     # In/out character encoding

...and on and on...

Currently, I do:

# (I'll stick these in a trivial class eventually, to stop module
# clutter).
UnknownOption = TidyUnknownOption
IndentSpaces = TidyIndentSpaces
WrapLen = TidyWrapLen
...


Is there a shorthand for this, or for something similar to this?  I want
to say 'expose that whole enum in Python, as a trivial class'.  I don't
much care if the options are accessible from Python as
_tidylib.SomeClass.UnknownOption or _tidylib.SomeClass.TidyUnknownOption,
or whatever -- that detail can be fixed in the Python code.

Thanks for any help


John





More information about the Pyrex mailing list