""" Ex. 5.10 from "A primer on..." From the shown usage of the class we see that it needs two special methods __call__ and __str__. """ class Hello: def __init__(self): self.greeting = 'Hello, ' def __call__(self, arg): return self.greeting + arg + '!' def __str__(self): return self.greeting + 'World!' a = Hello() print(a('students')) #output: Hello, students! print(a) #Hello, World! """ Terminal> python Hello.py Hello, students! Hello, World! """