Received from Brian Blais on Tue, Apr 07, 2009 at 02:48:51PM EDT:
> Hello,
>
> I am writing a tool to do some neural simulation, where I have several
> different neuron groups, which are defined as python classes. Is there a
> preferred way to write a cython-only replacement such that the end-user
> sees no difference? What I mean is that they should be able to do:
>
> import sim
>
> n1=sim.NeuronGroup1(5)
>
> sim.run_sim([n1])
>
> and if the cython version exists, use that one (for both the neuron
> group and the function to run the simulation), otherwise use the python
> one.
>
> thanks,
> Brian Blais
You could give the cython and python modules slightly different names
(e.g., sim_cython and sim_python) and create a wrapper module (called
sim) that contains the following code:
try:
from sim_cython import *
except ImportError:
from sim_python import *
L.G.
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev