On Oct 6, 2008, at 6:30 PM, Kevin Ar18 wrote: > >>> So I essentially need to merge several hundred lines of module code >>> into one file. :( >> >> Probably not, that depends on what you're trying to do. Sage has >> hundreds of .pyx and .py files that all work with each other. > > > A summary: > I have a project split among several pyx files/modules. > I want to convert as many vars, functions, and classes to Cython as > I can (this will leave a mix of Cython and Python). > > I need to be able to import my Cython and Python mixed modules and > then access the Cython vars, functions, and classes directly (as > well as the Python ones). > > I don't know how to do this unless I... > 1. Keep Python vars, functions, and classes in the modules that I > can call, since I can't call Cython stuff (this is not a good > option, since I want to convert as much to Cython as I can) > 2. merge all modules into one file
I would take a look at http://docs.cython.org/docs/ sharing_declarations.html . The only thing that you cannot do (currently) is cimport cython variables (like "cdef int i") from one module to another. We would like to support this, but for the moment it is a very small overhead, and the import would only need to happen once (e.g. the first time you load the module) unless your code depends heavily on setting module level variables from other modules, this shouldn't be an issue. In fact, if this is the case, you could restructure the code to have a cdef class that holds all the (previously global) variables. - Robert _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
