Does python internally overload the “==” when I implement the __cmp__ function in my class, just how we do that in C++ ?
Just curious. I am new to python. 🙂
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The meaning of
==as used in your Python code changes when you define__cmp__. In this particular sense, the “==-operator” on the Python level is modified by your definition of__cmp__(note that this is only true if you don’t also define__eq__).But the
operator==on the C++ level is not affected by this, for two reasons: