Skip to content

Instantly share code, notes, and snippets.

@IndhumathyChelliah
Last active July 15, 2020 04:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IndhumathyChelliah/bbd38592e7b478708e59265aa9be1bc5 to your computer and use it in GitHub Desktop.
Save IndhumathyChelliah/bbd38592e7b478708e59265aa9be1bc5 to your computer and use it in GitHub Desktop.
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