You can implement the __repr__ method for the class. It should return the string. If, for example, your class has the "name" attribute, you can just use:
def __repr__(self): return self.name
If you want to know more about the Data Science then do check out the following Data Science which will help you in understanding Data Science from scratch