About special method names

Python has multiple layers of implementation. We're interested in just two of them.

On the surface, we have Python's source text. This source text is a mixture of a traditional object-oriented notation and procedural function call notation. The postfix object-oriented notation includes object.method() or object.attribute constructs. The prefix notation involves function(object) constructs that are more typical of procedural programming languages. We also have an infix notation such as object+other. Plus, of course, some statements such as for and with invoke object methods.

The presence of function(object) prefix constructs leads some programmers to question the "purity" of Python's object orientation. It's not clear that ...

Get Mastering Object-oriented Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.