def __call__(self, *args, **kwargs): if self.cls and self.cls.__dict__.has_key(self.__name__): raise TypeError("Virtual method %s must be called from a subclass." % self.__name__) return method_decorator.__call__( self, *args, **kwargs )
def expensive_code(): # no args here! closure only return method_decorator.__call__(self, *args, **kwargs)