L
Luis José Novoa
Hi All,
Hope you're doing great. One quick question. I am defining an array of sets using numpy as:
a=array([set([])]*3)
Now, if I want to add an element to the set in, lets say, a[0], and I use the .add(4) operation, which results in:
array([set([4]), set([4]), set([4])], dtype=object)
which I do not want. If I use the union operator
a[0] = a[0] | set([4])
then I obtain what I want:
array([set([4]), set([]), set([])], dtype=object)
Can anyone explain whay this happens?
Thank you very much.
Hope you're doing great. One quick question. I am defining an array of sets using numpy as:
a=array([set([])]*3)
Now, if I want to add an element to the set in, lets say, a[0], and I use the .add(4) operation, which results in:
array([set([4]), set([4]), set([4])], dtype=object)
which I do not want. If I use the union operator
a[0] = a[0] | set([4])
then I obtain what I want:
array([set([4]), set([]), set([])], dtype=object)
Can anyone explain whay this happens?
Thank you very much.