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. :)
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. :)
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:
As opposed to what? That's what __cmp__ is for.
Though it's been deprecated for a while, and it's gone in 3 entirely, and you should use __eq__ and friends instead.
Yes, and likewise with a lot of other operators and methods. There's a full listing in the Python docs.