MLWhiz | AI Unwrapped

MLWhiz | AI Unwrapped

Share this post

MLWhiz | AI Unwrapped
MLWhiz | AI Unwrapped
Do you know about the Magic Methods in Python?
Copy link
Facebook
Email
Notes
More

Do you know about the Magic Methods in Python?

Rahul Agarwal's avatar
Rahul Agarwal
Feb 03, 2021
∙ Paid

Share this post

MLWhiz | AI Unwrapped
MLWhiz | AI Unwrapped
Do you know about the Magic Methods in Python?
Copy link
Facebook
Email
Notes
More
Share

Do you know about the Magic Methods in Python?

In my last post , I talked about Object-Oriented Programming(OOP). And I specifically talked about a single magic method __init__ which is also called as a constructor method in the OOP terminology.

The magic part of __init__ is that it gets called whenever an object is created automatically. But it is not the only one in any sense. Python provides us with many other magic methods that we end up using without even knowing about them. Ever used len(), print() or the [] operator on a list? You have been using Dunder methods.

In this post, I would talk about five of the most used magic functions or “Dunder” methods.

Keep reading with a 7-day free trial

Subscribe to MLWhiz | AI Unwrapped to keep reading this post and get 7 days of free access to the full post archives.

Already a paid subscriber? Sign in
© 2025 Rahul Agarwal
Privacy ∙ Terms ∙ Collection notice
Start writingGet the app
Substack is the home for great culture

Share

Copy link
Facebook
Email
Notes
More