Advanced Python: What Are Magic Methods?

This article highlights the must-know Python special methods that every Python programmer must be familiar with

Farhad Malik
FinTechExplained

--

The magic methods help us enrich our applications. They indirectly add magic to our Python code. This is an advanced level topic for Python developers and I recommend it to everyone who is/or intends in using the Python programming language.

The magic methods give us more control over how our application behaves.

Article Aim

This article aims to explain what magic methods are and how they can be used to build Python applications. It will provide an overview of the most widely used magic methods for a range of data types.

The purpose of outlining the key magic methods is for us to understand whether we want to override these methods in our custom classes to enrich the applications.

Magic methods make the Python programming language extremely powerful

Photo by Rodion Kutsaev on Unsplash

What Are The Python Magic Methods?

Python magic methods are also known as special methods or dunder methods. They are surrounded by double underscores e.g. __init__().

--

--

Farhad Malik
FinTechExplained

My personal blog, aiming to explain complex mathematical, financial and technological concepts in simple terms. Contact: FarhadMalik84@googlemail.com