If you want to create a string representation of an object, add __str__
and __repr__
.
__str__
shows readable outputs when printing the object. __repr__
shows outputs that are useful for displaying and debugging the object.
Find an example of these two methods above.