-2

I am trying to compare the values of any two objects, the datatype for which could be anything (including byte array, django objects, dictionary, boolean..... and so on). Right now I am using the '==' operator for the same. Is this the correct approach of comparing two objects?

Ajay Pal Singh
  • 682
  • 1
  • 5
  • 16

1 Answers1

2

'==' returns true if two objects are equal while 'is' returns true if the two variables point to the same object. Look at this page for a more in depth explanation: Is there a difference between `==` and `is` in Python?.

Are you asking how to compare two objects that are equal in value or if they are pointing at the same common object?

Community
  • 1
  • 1