El dv 19 de 01 del 2007 a les 18:08 +0200, en/na Stefan van der Walt va escriure: > On Fri, Jan 19, 2007 at 02:13:52PM +0000, Matt Knox wrote: > > > Moving the implementation to the C-level also has its downside. To > > > me, at least, Python code is much more readable and hence easier to > > > maintain. > > > > > > Is there a way that we can implement only the speed-critical methods > > > in C? > > > > > > Cheers > > > Stéfan > > > > > > > Implementing the whole thing in C also has the side benefit of the > > possibility > > making a nice C level api available to these sub-classes. And I suspect the > > core > > numpy developers are comfortable enough with C that maintainability is > > *probably* not a huge concern here. > > A "nice C level api" sounds like the definition of oxymoron :) Why > would we argue for more C than absolutely necessary in a Python-based > library?
I agree. In that sense, it would be nice to have a look at Pyrex and implement the main classes with it. Its syntax is very similar to Python, so doing this kind of translation should be pretty easy (at least, much more than doing it in pure C). Pyrex has parts of its syntax that are more C-flavored, and meant to reach high-performance (similar to C code) in the parts of the code that really need it, or allows you to link with pure C code easily. Its only major disavantage from my point of view is that it doesn't have support for easy indexing multi-dimensional arrays (you have to simulate the indexes through unidimensional indexes, but this has never been a problem for me) but if the amount of multidimensional job that you have to do on your code is small (if any), then, it becomes a very poweful tool for doing extensions IMO (you already should know that the random sub-package in NumPy has been built using Pyrex). My 2 cents, -- Francesc Altet | Be careful about using the following code -- Carabos Coop. V. | I've only proven that it works, www.carabos.com | I haven't tested it. -- Donald Knuth _______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion