[Cython] [SciPy-dev] Inclusion of cython code in scipy

William Stein wstein at gmail.com
Wed Apr 23 18:58:20 CEST 2008


On Wed, Apr 23, 2008 at 9:55 AM, Robert Bradshaw
<robertwb at math.washington.edu> wrote:
>
> On Apr 23, 2008, at 6:00 AM, Ondrej Certik wrote:
>
>  > On Wed, Apr 23, 2008 at 8:17 AM, Nathan Bell <wnbell at gmail.com> wrote:
>  >> On Tue, Apr 22, 2008 at 6:19 PM, Anne Archibald
>  >>  <peridot.faceted at gmail.com> wrote:
>  >>>
>  >>
>  >>>  What do people think about including cython code in scipy?
>  >>>
>  >>
>  >>  Writing a substantial amount of code in a special-purpose language
>  >>  like Cython is always risky.  Will Cython exist in 5,10,15 years?
>  >>
>  >>  I have little doubt that in 10 years I'll still be able to
>  >> compile the
>  >>  C/C++ codes I develop today.  Furthermore, if Cython/SWIG/SciPy/
>  >> NumPy
>  >>  disappeared overnight I'd still have a decent library to work with.
>  >>  IMO using Cython for one-off application or wrappers is fine, but
>  >>  large-scale Cython implementation is probably a bad long-term
>  >>  approach.
>  >
>  > Isn't this a similar (if not the same) problem when writing your code
>  > using SWIG?
>  >
>  > Let's take sparsetools.i as an example, it also contains a lot of non
>  > python, non C code. So one needs to depend (and maintain!) SWIG. Well,
>  > Cython is a lot more lightweight and more robust solution imho.
>  >
>  > Of course it'd be great if the Cython code would also be a regular
>  > Python code, but that will still take some time. But they seem to like
>  > it, for example when I first learned about Cython, I told Robert and
>  > William -- why to use this ugly "for i from 1 <= i < dim:", why not to
>  > use the python way
>  > "for i in range(1, dim):"? And Robert has implemented this in less
>  > than a month.
>  >
>  > The next step could be to generate Cython code from regular Python
>  > code with annotations in comments or strings imho.
>
>  Yes, one of our goals is to be able to compile pure Python, with type
>  annotations in decorators. The "old style" cdef keywords will be
>  around too.
>
>
>  > But even if Cython stays as yet another language -- it's still easier
>  > and less error prone than to write the C code by hand.
>
>  I am of the same opinion, and think Cython will be around for a long
>  time (hopefully eventually as part of Python itself).

Just to emphasize -- one of the *main longterm goals* of starting the
Cython project was to get Cython into Python itself.

 -- William


More information about the Cython-dev mailing list