Everything in Python is an object. Each object has some special internal methods which it uses to interact with other objects. Generally, these methods follow the __action__ naming convention. Collectively, this is termed as the Python Data Model.
You can overload any of these methods. This is commonly used in operator overloading in Python. Below is an example of operator overloading using Python's data model. The Vector class creates a simple vector of two variables. We'll add appropriate support for mathematical operations of two vectors using operator overloading.
The above example demonstrates overloading of basic numeric operators. A comprehensive list can be found here.
This modified text is an extract of the original Stack Overflow Documentation created by following contributors and released under CC BY-SA 3.0