Predict

The Attribute Ghost

__getattr__ is a fallback hook. Python calls it only after normal lookup (the instance, then the class and its parents) fails.

class Ghost:
    def __init__(self):
        self.real = "lamp"

    def __getattr__(self, name):
        return f"<no {name}>"

g = Ghost()
print(g.real, g.wick)

What does this program print?