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: 30-Jul-2019

325 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements