Skip to content

Instantly share code, notes, and snippets.

@davidevans
Created June 26, 2013 19:04
Show Gist options
  • Save davidevans/5870445 to your computer and use it in GitHub Desktop.
Save davidevans/5870445 to your computer and use it in GitHub Desktop.
delayed decorator
class X():
def inherited_func(self, func):
raise NotImplemented
def x_decorator(func):
def handler(self, *args,**kwargs):
print "In X handler"
self.inherited_func(func)(*args,**kwargs)
return handler
@x_decorator
def test(self):
print "In Test"
pass
class Y(X):
def inherited_func(self, func):
def handler(*args,**kwargs):
print "In Y handler"
return func(self,*args,**kwargs)
return handler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment