We use ‘is’ to check an object against its identity.
We use ‘==’ to check equality of two objects.
E.g.
>>> lst = [10,20, 20]
>>> lst == lst[:]
True
>>> lst is lst[:]
False
We use ‘is’ to check an object against its identity.
We use ‘==’ to check equality of two objects.
E.g.
>>> lst = [10,20, 20]
>>> lst == lst[:]
True
>>> lst is lst[:]
False
by
Tags:
Leave a Reply