1 May 2012 11:21
Re: [Cython] [cython-users] Conditional import in pure Python mode
>>> On 29 April 2012 01:33, Ian Bell wrote:
>>>> idiom like
>>>>
>>>> if cython.compiled:
>>>> cython.import('from libc.math cimport sin')
>>>> else:
>>>> from math import sin
Actually, in this particular case, I would even accept a solution that
special cases the "math" module internally by automatically cimporting
libc.math as an override (or rather an adapted version as plain "math.pxd").
This CEP describes a general approach:
http://wiki.cython.org/enhancements/overlaypythonmodules
It's partly outdated, so things may have become easier these days.
Stefan
RSS Feed