On Tue, Apr 28, 2015 at 7:00 AM, Benjamin Root <ben.r...@ou.edu> wrote:
> I have a need to have a numpy array of 17 byte (more specifically, at > least 147 bits) values that I would be doing some bit twiddling on. I have > found that doing a dtype of "i17" yields a dtype of int32, which is > completely not what I intended. Doing 'u17' gets an "data type not > understood". I have tried 'a17', but then bitwise_or() and left_shift() do > not work (returns "NotImplemented"). > > How should I be going about this? > The correct type to use would be a void dtype: >>> dt = np.dtype('V17') >>> dt.itemsize 17 Unfortunately, it does not support bitwise operations either, which seems like an oddity to me: >>> a = np.empty(2, dt) >>> a[0] = 'abcdef' >>> a[1] = bytearray([64, 56, 78]) >>> a[0] | a[1] Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unsupported operand type(s) for |: 'numpy.void' and 'numpy.void' Any fundamental reason for this? Jaime -- (\__/) ( O.o) ( > <) Este es Conejo. Copia a Conejo en tu firma y ayúdale en sus planes de dominación mundial.
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion