def auto_update ( cls , function ) : def wrapper ( self , * args , * * kwargs ) : f = function ( self , * args , * * kwargs ) self . update ( ) return f return wrapper
python how to decorate for both instance methods
This class method could be used as decorator on subclasses it ensures update method is called after function execution .
def auto_update(cls, function):
        """
        This class method could be used as decorator on subclasses, it ensures
        update method is called after function execution.
        """

        def wrapper(self, *args, **kwargs):
            f = function(self, *args, **kwargs)
            self.update()
            return f
        return wrapper