What I Did Today
- Learnt Dunder Methods
On What I Did Today
MAGIC METHODS / DUNDER METHODS
This are methods that start and end in double underscores hence the name DUNDER
We have many dunder methods. To see a list of them just run print(dir(init)) it will display a list of all the dunder methods present in python.
In our case we will discuss 2 Dunder methods.
- init -> The magic method allows you to define your data here.
2.string
-> This a magic method that allows you to give a description of a class.
The advantage of having dunder methods is that you don't need to call them.
Since they are defined inside the class when you call the class when defining an object it automatically executes.
ALSO
Dunder methods always have a paramter self inside them.
Resources I used
- Python Refresher Series By Bonaventure Ogeto On Youtube.
- Github For Documenting and Pushing to my Public Repository
What's Next
Python OOP Basics Part 2

Top comments (0)