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

Angus McMorland amcmorl@gmail....
Thu Aug 30 03:30:16 CDT 2007

On 30/08/2007, dmitrey <openopt@ukr.net> wrote:
> hi all,
> what's the easiest way to create bool array that contains m1 True, m2
> False, m3 True, m4 False?
> Or (alternatively) creating same Python list instead.

How about "n.array([bool(1 - (x % 2)) for x in xrange(length)])"?

AJC McMorland, PhD Student
Physiology, University of Auckland

More information about the SciPy-user mailing list