Programming Concepts : Object Oriented Programming (OOP) in Python
Magic Methods
Magic methods are specifically designed for overriding and customizing default python behavior.
Examples of magic methods include
__init__, __add__, __repr__,
etc.
Here are 2 guides on python magic methods. One and Two.
__init__ methods allows you to customize how python instantiates an object.
__add__ method overrides the functionality of the plus sign in python.
__repr__method allows you to control what get’s printed out on the console.
Got to Next page to learn more about Inheritance in Object Oriented Programming in Python
Leave a Comment