[Pyrex] [PATCH] 'include' statements inside 'cdef class' level

Caio Marcelo cmarcelo at gmail.com
Wed Sep 5 15:40:11 CEST 2007


On 9/5/07, Robert Bradshaw <robertwb at math.washington.edu> wrote:
> from include-happy C developers). You clearly have reason in mind for
> wanting this patch, could you please elaborate? Would being able to
> cimport module-level cdef functions solve the problem as well?

I'm working on a binding generator for a GUI toolkit (it's called
ETK). This toolkit is built in
C, and my generator reads C header files and output pyrex code. The
problem is, I want to
provide "handmaded" code for some methods. The way I imagined (and it
seems technically
easier to support) is tell the generator which methods to skip, and
include a "file_over.pxi"
where I'll put my handmade methods.

Other solution would be: I could provide file_over.pxi for my
generator and it would include
in one resulting pxi file (like pygtk binding generator works). Or
subclassing the classes
generated and put the overrides there (and making sure that the "real"
subclasses use
the one with overrides as parent).

I am open to suggestions, but will allowing that kind of include cause
more harm than
benefit? (given that technically it seems a trivial thing to do).


Cheers,
  Caio Marcelo



More information about the Pyrex mailing list