[Cython] Conditional import in pure Python mode
stefan_ml at behnel.de
Tue May 1 21:51:18 CEST 2012
mark florisson, 01.05.2012 21:39:
> On 1 May 2012 20:22, Stefan Behnel wrote:
>> Stefan Behnel, 01.05.2012 21:14:
>>> 2) Use math.pxd as an override for the math module. I'm not sure yet how
>>> that would best be made to work, but it shouldn't be all that complex. It
>>> already works (mostly?) for numpy.pxd, for example, although that's done
>>> explicitly in user code.
>> BTW, I think it would be helpful to make the numpy.pxd cimport automatic as
>> well whenever someone does "import numpy" and friends, right?
> I'm not sure, it means the user has to have numpy development headers.
Hmm, right. What about making it an explicit compile time option then?
# cython: override_modules = math,numpy
Or should we go for an opt-out?
# cython: python_modules = math,numpy
Sounds like it would hit the more common case by default.
More information about the cython-devel