I know that __call__ method in a class is triggered when the instance of a class is called. However, I have no idea when I can use this special method, because
__call__
Class-based decorators use __call__ to reference the wrapped function. E.g.:
class Deco(object): def __init__(self,f): self.f = f def __call__(self, *args, **kwargs): print args print kwargs self.f(*args, **kwargs)
There is a good description of the various options here at Artima.com