4 ms·
Good point. I was a bit surprised when I found out that Javascript's `Math.min(...[]) ` and `Math.max(...[])` return +Infinity and -Infinity, respectively. But
by graup 7y ago
Good point. I was a bit surprised when I found out that Javascript's `Math.min(...[])
` and `Math.max(...[])` return +Infinity and -Infinity, respectively. But after thinking about it, it makes a lot of sense. It does the right thing when the argument is an empty list.
- enriquto 7y agoMaybe the justification is that you do not know the type of an empty python list. But numpy at least could assume that the numbers are floats and give the correct result instead of raising an error (and thus complicating the interface).
- throwaway_pdp09 7y ago> Maybe the justification is that you do not know the type of an empty python list. Excellent point, thanks!