Category Archives: Python

Operator overloading

For me it is important to write short, easy to read and easy to understand code. When you write a piece of code and see it after a couple of months or even years the meaning should be clear in an instant. One way to achieve brevity in programming is the use of operator overloading. With this it is possible to change the meaning of an operator.

In this example I’ll take two interpreted languages I use (Python and PHP) and show how those languages differ in the support for operator overloading and why Python has a more elegant solution to this problem.
Continue reading Operator overloading