1. Home
  2. Data Science
  3. Python
  4. Which special method makes two objects comparable with ==…

Added 25 Nov 2026

Which special method makes two objects comparable with == in Python?

  1. __eq__ Correct answer
  2. __equals__
  3. __cmp__
  4. __same__

Correct answer

A. __eq__

6 views

MCQSEXAM

Explanation

__eq__ defines equality comparison.

Reference

Asked in: Python Interview OOP

https://docs.python.org/3/tutorial/classes.html

Preparing for an exam?

Doubts & discussion

Not sure why the answer is A? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More Python MCQs

Practise all Python MCQs

Similar MCQs