Multiple equates

Arnaud Delobelle arnodel at googlemail.com
Mon Nov 17 14:10:03 EST 2008


jzakiya <jzakiya at mail.com> writes:

> I looked online and in books, but couldn't find a definitive answer to
> this.
>
> I have an array and set multiple elements to either True or False at
> one time.
>
> Question: Which way is faster (or does it matter)?
>
> 1)
>
> array[x1]=array[x2]=........= array[x10] = \
> array[x11]=array[x12]=... = array[x20] = \
> ......
> ......
> array[x40]=array[x41]=....= array[x50] = False (or True)
>
>
> 2)
>
> array[x1]=array[x2]=........= array[x10] = False
> array[x11]=array[x12]=... = array[x20] = False
> ......
> ......
> array[x40]=array[x41]=....= array[x50] = False

It doesn't matter as none of this is valid Python. In Python you have to
write

array[x1] = False
array[x2] = False

Etc...

-- 
Arnaud



More information about the Python-list mailing list