+ 1
__init__
im not so sure whats __init__ or __str__ at all can some one please explain it to me please
1 Antwort
0
Functions starting and ending with double underscores __ are called special methods or dunder methods.
You can use it to override behaviors of built-in types in your class.
__init__ dunder is a constructer which takes care of setting up the object. Whenever an object of a class is instantiated, this method is called.
__str__ is used to represent objects. Whenever you use print function, this method is called.