[SciPy-dev] Inclusion of cython code in scipy

Nathan Bell wnbell@gmail....
Wed Apr 23 09:52:22 CDT 2008


On Wed, Apr 23, 2008 at 3:02 AM, Stéfan van der Walt <stefan@sun.ac.za> wrote:
>
>  The idea is, of course, that Cython should ultimately *not* be a
>  special-purpose language, but as close to Python as possible.  That is
>  also why we rely on those two GSOC projects, which try to eliminate
>  the ndarray indexing differences between Python and Cython.  That way,
>  in 10 years you'll still have Python code, even if cython doesn't
>  exist any more.  Hopefully, by then, PyPy or some such project would
>  have capitalised on VM developments to such extent that your Python
>  code runs as fast as the current C code (look at what the jruby guys
>  have accomplished, for example).

Then, of course, the discussion is moot.

However, a cursory look at the current SAGE source code reveals that
*in practice* Cython is very much a special-purpose language.

>  Your SWIG wrappers are easy to read, but that is not the case for some
>  other parts of NumPy and SciPy, though, so I buy Matthew's argument:
>  to increase the number of eyes on our code, we should improve
>  readability.

That argument works as long as Cython source code resembles Python
source code in appearance and function.

>  For example, I could see that implementing lil_matrix in
>  Cython would make sense, given that it runs for loops over Python
>  lists.  Also, a great number of bugs in NumPy originate from reference
>  counting errors, which are notoriously hard to catch; Cython helps
>  skirt those issues.

I agree, lil_matrix is a good candidate for Cython.

-- 
Nathan Bell wnbell@gmail.com
http://graphics.cs.uiuc.edu/~wnbell/


More information about the Scipy-dev mailing list