When I try to print an instance of a class, I get an output like this:
>>> class Test():
... def __init__(self):
... self.a = 'foo'
...
>>> print(Test())
<__main__.Test object at 0x7fc9a9e36d60>
How can I can define the printing behaviour (or the string representation) of a class and its instances? For example, referring to the above code, how can I modify the Test class so that printing an instance shows the a value?