Multiple equates

jzakiya jzakiya at mail.com
Mon Nov 17 14:23:12 EST 2008


On Nov 17, 2:10 pm, Arnaud Delobelle <arno... at googlemail.com> wrote:
> jzakiya <jzak... 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

Could you explain please.
Python allows this, so is it just not considered good idiomatic
python?

jz



More information about the Python-list mailing list