I'm using NumPy with Python 2.6.2. I'm trying to create a small (length 3), simple boolean array. The following gives me a MemoryError, which I think it ought not to.
import numpy as np
cond = np.fromiter((x in [2] for x in [0, 1, 2]), dtype = np.bool)
The error it gives me is:
MemoryError: cannot allocate array memory
However, the following method of obtaining a list (as opposed to an ndarray) works fine (without using numpy):
cond = list((x in [2] for x in [0, 1, 2]))
Have I done anything wrong in the Numpy code? My feeling is that it ought to work.