Gerard Vermeulen wrote:
In current SVN, I think improved on the current state by only calling a scalar a signed integer if it is actually negative (previously only it's data-type was checked and all Python integers get converted to PyArray_LONG data-types which are signed integers).
This fixes the immediate problem, I think.
What are opinions on this scalar-coercion rule?
Hmm, this is a consequence of your rule:
from numpy import *; core.__version__
'0.9.5.2024'
a = arange(3, dtype=uint32) a-3
array([4294967293, 4294967294, 4294967295], dtype=uint32)
a+-3
array([-3, -2, -1], dtype=int64)
(a-3) == (a+-3)
array([False, False, False], dtype=bool)
Do you think that the speed-up justifies this? I don't think so.
It's still hard to say if it justifies it or not. One way of writing a-3 causes automatic upcasting while the other way doesn't. This might be a good thing, depending on your point of view. I could see people needing both situations. These things are never as clear as we'd like them to be. But, I could also accept a rule that treated *all* integers as the same kind in which case a-3 and a+(-3) would always return the same thing. I'm fine with it either way. So what are other opinions? -Travis