En Mon, 20 Apr 2009 04:03:28 -0300, bdb112 <boyd.blackw...@gmail.com>
escribió:
Is there any obvious reason why
[False,True] and [True,True]
gives [True, True]
Yes: short-circuit evaluation.
[False,True] and [True,True] is *not* an element-by-element operation,
it's a simple expression involving two objects (two lists).
A and B means: check the boolean value of A; if it's false, return A.
Else, return B.
A non-empty list has a boolean value of true, so the second list is
returned.
If you want an element-wise operation:
A = [False,True]
B = [True,True]
result = [a and b for a,b in zip(A,B)]
--
Gabriel Genellina
--
http://mail.python.org/mailman/listinfo/python-list