-
-
Save IndhumathyChelliah/bbd38592e7b478708e59265aa9be1bc5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d1={'a':1,'b':2,'c':3} | |
d2={'a':1,'c':3,'b':2} | |
#In dict equality operations doesn't check for matching order.It is order-insensitive. | |
print (d1==d2)#Output:True | |
from collections import OrderedDict | |
d3=OrderedDict({'a':1,'b':2,'c':3}) | |
d4=OrderedDict({'a':1,'c':3,'b':2}) | |
#Equality operations in OrderedDict checks for matching order.It is order-sensitive. | |
print (d3==d4)#Output:False | |
#equality operations between dict and OrderedDict.It is order-insensitive. | |
print (d1==d4)#Output:True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment