Skip to main content

One post tagged with "python"

View All Tags

Do you know what magic methods are in Python? Hint: You use them every day!

· 10 min read
Marco Antônio Martins Porto Netto
Full‑Stack Dev & AI Enthusiast

This article was originally published on LinkedIn.

Dunder Methods

Do you know what magic methods are in Python? Hint: You use them every day!

A few years ago, when I was learning to use the Django framework (the first framework I ever learned), I came across a peculiar characteristic of Python classes: the constructor method has to follow a specific pattern — it must be identified by double underscores (__) before and after the word init. That struck me as odd; why this specific structure?