On Friday, 17 October 2014 at 17:16:29 UTC, Ola Fosheim Grøstad wrote:
Accurate is slower, but not this:

sum(a)/len(a)

Forgot to point out that the original point with mentioning Python in the thread is:

1. Compiled static languages still have a long way to go with expressiveness.

2. Generic operations on double will lead to wrong results. What happens if your first value is very large? You loose the accumulation of the smaller values, in the worst case you only get the first value. Thus you will have to sort the values by exponent before accumulating or convert it into a different format.

So yes, C++ iterators and D ranges are kind of cool, but cannot beat a well engineered library and a good mapping to it on the language side. (Python is of course not optimal in any way.)

Reply via email to