'How to print a defined value for custom class in Spyder Variable Explorer?

I have a list of objects of a custom class, which has a string name that makes me understand what it contains. I'd like to see this name under the value column when I inspect the objects list on Spyder variable explorer, instead of the class name.

Which class method should I implement to get this done? I tried to look for this but I didn't find any information in the documentation.

Thank you

Spyder Variable Explorer example



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source