Re: [Cython] [cython-users] Conditional import in pure Python mode

2012-05-01 Thread Stefan Behnel
Ian Bell, 01.05.2012 15:50: > On Tue, May 1, 2012 at 9:21 PM, Stefan Behnel wrote: > 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

Re: [Cython] [cython-users] Conditional import in pure Python mode

2012-05-01 Thread Stefan Behnel
>>> 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

Re: [Cython] [cython-users] Conditional import in pure Python mode

2012-04-30 Thread mark florisson
On 30 April 2012 14:55, Stefan Behnel wrote: > mark florisson, 30.04.2012 15:24: >> So lets assume we want to use the following syntax: stdio = >> cython.cimport_module("libc.stdio"). >> >> In the TransformBuiltinMethods you add another case to the >> visit_SimpleCallNode > > That seems way too la

Re: [Cython] [cython-users] Conditional import in pure Python mode

2012-04-30 Thread Stefan Behnel
mark florisson, 30.04.2012 15:24: > So lets assume we want to use the following syntax: stdio = > cython.cimport_module("libc.stdio"). > > In the TransformBuiltinMethods you add another case to the > visit_SimpleCallNode That seems way too late in the pipeline to me (see Pipeline.py). I think thi

Re: [Cython] [cython-users] Conditional import in pure Python mode

2012-04-30 Thread mark florisson
On 30 April 2012 13:14, Ian Bell wrote: > > On Sun, Apr 29, 2012 at 10:58 PM, mark florisson > wrote: >> >> On 29 April 2012 01:33, Ian Bell wrote: >> > Hello Cython users, >> > >> > I haven't the foggiest idea how easy this would be to implement, or how >> > to >> > do it in the first place, bu