Which version of NumPy are you using. This could be an artefact of the new casting rules.
This used to work. So, yes, this is definitely a bug. -Travis On Apr 5, 2012, at 10:54 PM, Chris Laumann wrote: > Hi all- > > I've been trying to use numpy arrays of ints as arrays of bit fields and > mostly this works fine. However, it seems that the bitwise_* ufuncs do not > support unsigned integer dtypes: > > In [142]: np.uint64(5)&3 > --------------------------------------------------------------------------- > TypeError Traceback (most recent call last) > /Users/claumann/<ipython-input-142-65e3301d5d07> in <module>() > ----> 1 np.uint64(5)&3 > > TypeError: ufunc 'bitwise_and' not supported for the input types, and the > inputs could not be safely coerced to any supported types according to the > casting rule ''safe'' > > This seems odd as unsigned ints are the most natural bitfields I can think of > -- the sign bit is just confusing when doing bit manipulation. Python itself > of course doesn't make much a distinction between ints, longs, unsigned etc. > > Is this a bug? > > Thanks, Chris > > -- > Chris Laumann > Sent with Sparrow > > _______________________________________________ > NumPy-Discussion mailing list > NumPy-Discussion@scipy.org > http://mail.scipy.org/mailman/listinfo/numpy-discussion
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion