On Dec 14, 2009, at 11:22 AM, Dag Sverre Seljebotn wrote: > Stefan Behnel wrote: >> Dan Stromberg, 14.12.2009 17:27: >>> Stefan Behnel wrote: >>>> I assume you know that Cython can compile .py files and has a >>>> pure Python >>>> syntax for type declarations? >>>> >>>> http://wiki.cython.org/pure >>>> >>> Actually, I didn't know that. It's interesting, but I don't think >>> it's >>> what I want; I'm looking for something that will allow my code to >>> not >>> depend on cython at all in one form. >> >> Your code /won't/ depend on Cython, that's what this is all about. >> All you >> need is a tiny cython.py file in your distribution that implements >> a dummy >> 'cython' module (we actually ship that). That's all you add as a >> "dependency" to your otherwise normal Python code. It will run in the >> normal Python interpreter, although it will run faster if you use >> Cython to >> compile it. > > Be advised however that a) there's quite a few features not > available in > pure Python mode,
Though it may be interesting how far we could get with ctypes. > and b) one has to be a bit careful because sometimes > when writing code in pure Python mode, it could mean one thing in > Python > and another in Cython, as the semantics are not closely enough lined > up > (yet). > > As long as one know what one is doing and knows Cython pretty well, > it's > pretty good though. And when it doesn't, we'd like to know. > Another approach that was mentioned here some time ago was a script > that > would take Cython code (well, a subset) and transform it into pure > Python code. I don't remember the final outcome though. IIRC, there was some interest, but it was a lot lower on the priority list than most other stuff. There were also a lot of unworked out details (would we emulate integer overflow truncation? Extension class irregularities?) Also, it seems the pure mode satisfies the "one source file" concept better than a preprocessor. - Robert _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
