On Fri, Apr 6, 2012 at 12:01 AM, Charles R Harris <charlesr.har...@gmail.com > wrote:
> > > On Thu, Apr 5, 2012 at 11:57 PM, Travis Oliphant <tra...@continuum.io>wrote: > >> As of 1.5.1 this worked: >> >> >>> numpy.__version__ >> 1.5.1 >> >>> numpy.uint64(5) & 3 >> 1L >> >> >> So, this is a regression and a bug. It should be fixed so that it >> doesn't raise an error. I believe the scalars were special cased so that a >> raw 3 would not be interpreted as a signed int when it is clearly unsigned. >> The casting rules were well established over a long period. They had >> issues, but they should not have been changed like this in a 1.X release. >> >> Fortunately there are work-arounds and these issues arise only in corner >> cases, but we should strive to do better. >> >> > I disagree, promoting to object kind of destroys the whole idea of bitwise > operations. I think we *fixed* a bug. > Although 1.5.1 also gives >>> np.uint(3) + 4 7.0 i.e., a float, which certainly doesn't look right either. Whereas >>> np.int(3) + 4 7 The float promotion is still there in 1.6.1 In [4]: uint64(1) + 2 Out[4]: 3.0 So I suppose there is the larger question is how combining numpy scalars with python scalars should be done in general. Chuck
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion