I have the following code of two binary lists and I want to obtain a resulting list in which the element i
will be the OR
operation applied to the i
elements of the two lists:
from operator import ior
l_0 = [01100]
l_1 = [11000]
print map(ior, l_0, l_1)
And I was expecting a result of [11100]
, but the result is:
[11000]
I have checked ior operator and the documentation says that it performs the operation:
a = ior(a, b) is equivalent to a |= b
So I tried the following to check as well:
print ior(0,0)
print ior(1,0)
print ior(0,1)
print ior(1,1)
Getting as results:
0
1
1
1
Which makes sense, but doesn't coincide with the result obtained in the 3rd position of the lists. I don't understand why the result of the map operation of above is not [11100]
. I am missing something here and I hope that you can throw some light on it.