News for hackers. Stuff that matters.
Re:Using D and std.ndslice as a Numpy Replacement by vidarh on Saturday January 02, 2016 @09:30PM (#10829225)
> Does D have code for: [...]

He covered this, specifically out that Numpy has an advantage in the number of libraries and other resources available for it.

> because everyone else in the world knows and uses them;

No, everyone working in some specialized niches does. And those niches don't even scratch the surface of the number of people who regularly do simple operations on multi-dimensional arrays but who don't need most of what you list.

And sometimes people even in your niche that does depend on the other stuff run into things that are just way too slow, that they have to rewrite in a lower level language.

There are plenty of people for whom this will be very useful without having all the support infrastructure around Numpy in place.

> I can't think of any reason I'd ever reach for D.

D is for people who wants a "C++ done right", where it is implicit that you want a C-like language, and share ideals of C++ such as to whatever extent possible not paying for what you don't use.

Specifically in this case, you'd reach for D if you need multi-dimensional arrays and either prefer a C++-like language over Python or your Python code is too slow and you prefer to avoid a lower level language like C.

That may not be for you, and that's fine. Just like Numpy isn't nearly universal for numerical computing.

> Yes, my np.mean() might be slower than your map(). I almost always don't care.

I find this an amusing objection... I did my MSc thesis on methods for reducing error rates in OCR, and included methods that used various nearest-neighbour variations and statistical methods on bitmap slices and similar.

I did it mainly in Ruby (with some inline C where absolutely necessary for performance - if I remember correctly it was about a dozen lines of code in C) because I cared far more about readable code than fast code, and Python would in my eyes have been a double loss: not the speed of C, yet still ugly and annoying to work with in my opinion.

Seeing the D code examples, I might very well have picked D for it today.

There are no comments on this comment yet.