[Numpy-discussion] Proposed Roadmap Overview

Jason Grout jason-sage@creativetrax....
Fri Feb 17 21:27:02 CST 2012


On 2/17/12 9:07 PM, Sturla Molden wrote:
>
> Den 18. feb. 2012 kl. 01:58 skrev Charles R Harris
> <charlesr.harris@gmail.com <mailto:charlesr.harris@gmail.com>>:
>
>>
>>
>> On Fri, Feb 17, 2012 at 4:44 PM, David Cournapeau <cournape@gmail.com
>> <mailto:cournape@gmail.com>> wrote:
>>
>>     I don't think c++ has any significant advantage over c for high
>>     performance libraries. I am not convinced by the number of people
>>     argument either: it is not my experience that c++ is easier to
>>     maintain in a open source context, where the level of people is
>>     far from consistent. I doubt many people did not contribute to
>>     numoy because it is in c instead if c++. While this is somehow
>>     subjective, there are reasons that c is much more common than c++
>>     in that context.
>>
>>
>> I think C++ offers much better tools than C for the sort of things in
>> Numpy. The compiler will take care of lots of things that now have to
>> be hand crafted and I wouldn't be surprised to see the code size
>> shrink by a significant factor.
>
> The C++11 standard is fantastic. There are automatic data types,
> closures, reference counting, weak references, an improved STL with
> datatypes that map almost 1:1 against any built-in Python type, a sane
> threading API, regex, ect. Even prng is Mersenne Twister by standard.
> With C++11 it is finally possible to "write C++ (almost) like Python".
> On the downside, C++ takes a long term to learn, most C++ text books
> teach bad programming habits from the beginning to the end, and C++
> becomes inherently dangerous if you write C++ like C. Many also abuse
> C++ as an bloatware generator. Templates can also be abused to write
> code that are impossible to debug. While it in theory could be better, C
> is a much smaller language. Personally I prefer C++ to C, but I am not
> convinced it will be better for NumPy.
>
> I agree about Cython. It is nice for writing a Python interface for C,
> but get messy and unclean when used for anything else. It also has too
> much focus on adding all sorts of "new features" instead of correctness
> and stability. I don't trust it to generate bug-free code anymore.

For what it's worth, Cython supports C++ now.  I'm sure there are people 
on this list that know much better than me the extent of this support, 
so I will let them chime in, but here are some docs on it:

http://docs.cython.org/src/userguide/wrapping_CPlusPlus.html

If you have specific examples of new features trumping correctness and 
stability, I'm sure the Cython devel list would love to hear about it. 
They seem to be pretty concerned about stability and correctness to me, 
though I admit I don't follow the list extremely deeply.

I don't trust any automated tool to generate bug-free code.  I don't 
even trust myself to generate bug-free code :).

Jason


More information about the NumPy-Discussion mailing list