+ 4

Difference between (is) and(==)?

print([]==[])#output is True print([]is[])#output is False (why?!) print(()==())#output is True print(()is())#output is True

21st Jan 2018, 8:51 PM
Tilok Saha
Tilok Saha - avatar
1 Answer
+ 1
[] is [] are 2 different list objects. so it doesnt point to the same object. == checks equality.
21st Jan 2018, 9:03 PM
emmey
emmey - avatar