What is operator binding in Python?

PythonProgramming

For expressions like −

a == b

first the python interpreter looks up the __eq__() method on the object a. If it finds that, then executes that with b as argument, ie, a.__eq__(b). If this method returns a NotImplemented, then it tries doind just the reverse, ie, it tries to call,

b.__eq__(a)
raja
Published on 19-Apr-2018 12:38:21
Advertisements