Special methods I -- Representation
>>> class A:
...
def __str__(self):
...
return ‘Hi there’
...
def __repr__(self):
...
return ‘Instance of A’
...
>>> A()
Instance of A
>>> print A()
Hi there
>>> str(A())
Hi there