What is operator binding in Python?



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)
Updated on: 2019-07-30T22:30:22+05:30

470 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements