I was working with the date structure of set implemented in python.
I can define a set as:
set_1 = set([1, 2])
and also as set_2 = {1, 2}
.
if I run set_1 == set_2
it evaluate to True
but if I run set_1 is set_2
it evaluate to False
.
So what are the difference between this two implementations?
Asked
Active
Viewed 573 times
0

vigte
- 95
- 1
- 8
-
thanks, Yes it was a duplication but I did not notice it since I was thinking at `is` as an equivalent version of javascript `===`. – vigte Oct 12 '14 at 13:26
1 Answers
0
is
is an identity operator where as ==
checks for only values. It's already answered, check this question.
-
thanks, Yes it was a duplication but I did not notice it since I was thinking at `is` as an equivalent version of javascript `===`. – vigte Oct 12 '14 at 13:26