Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
import sys
class Decor(object):
def __init__(self, f, c):
print "Decor.__init__"
self._f = f
self._c = c
def __call__(self):
print "Decor.__call__"
print self._f, self._c
self._f()
class B(object):
def __init__(self):
print "B.__init__"
print self.__class__
self.func = Decor(self._func, self.__class__)
def _func(self):
print "B._func"
print "Creating .."
b = B()
print
print "Calling .."
b.func()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment