If a class defines it, this special method is called to find the “representation” of an object. There are two ways to get a representation:
Via the function described in Section 21.17, “repr(): Representation”.
Via the “back-quote operator”, enclosing a Python expression in open single quotes.
The calling sequence is:
def __repr__(self):
...
The method returns the representation of self as a string.