It doesn't matter as none of this is valid Python. In Python you have to
write
array[x1] = False
array[x2] = False
Uh...not so much...
>>> a = [1,2,3,4,5]
>>> x1, x2 = 1, 3
>>> a[x1] = a[x2] = False
>>> a
[1, False, 3, False, 5]
Works for me.
To the OP, I think rather than cluttering my code, I'd just
create a loop
for i in [x1,x2,x3,x4,...x1024]:
a[i] = False
From Diez's disassembly of it (as an aside, nifty little intro
to dis.dis()...thanks, Diez!), it looks like it boils down to "is
DUP_TOP faster than LOAD_CONST" because the rest of the
operations. At this point, it's pretty nitty-gritty.
Unless the code is in an inner loop somewhere, the simple loop
should be more than fast enough. Without knowing the source of
the [x1,...] index variables, it's hard to tell if there's a more
optimal way to do this.
-tkc
--
http://mail.python.org/mailman/listinfo/python-list