Operator Overloading

suggest change

Everything in Python is an object. Each object has special methods which it uses to interact with other objects. Generally, these methods follow the __action__ naming convention. Collectively, this is the Python data model.

A class can implement these methods to support operators. The interpreter looks them up on the class, not on the instance. Numeric special methods such as __add__ and __mul__ are documented under emulating numeric types.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents