[SciPy-user] what is simpliest way to create this boolean array

Stefan van der Walt stefan@sun.ac...
Thu Aug 30 03:41:53 CDT 2007

On Thu, Aug 30, 2007 at 10:40:01AM +0300, dmitrey wrote:
> what's the easiest way to create bool array that contains m1 True, m2 
> False, m3 True, m4 False?

Don't know whether there is any absolute easiest way, but this should work:

In [6]: x = N.ones(30).astype(bool)

In [7]: x[1::2] = False


More information about the SciPy-user mailing list