Question
Asked By – Dejas
I’m a little confused about the python in
operator for sets.
If I have a set s
and some instance b
, is it true that b in s
means “is there some element x
in s
such that b == x
is true
“?
Now we will see solution for issue: Python’s “in” set operator
Answer
Yes, but it also means hash(b) == hash(x)
, so equality of the items isn’t enough to make them the same.
This question is answered By – Ignacio Vazquez-Abrams
This answer is collected from stackoverflow and reviewed by FixPython community admins, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0