Skip to content

Instantly share code, notes, and snippets.

@Abhishek-Srivastava
Last active December 17, 2015 17:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Abhishek-Srivastava/5648431 to your computer and use it in GitHub Desktop.
Save Abhishek-Srivastava/5648431 to your computer and use it in GitHub Desktop.
def entryExit(f):
def new_f():
print "Entering", f.__name__
f()
print "Exited", f.__name__
new_f.__name__ = f.__name__
return new_f
@entryExit
def func1():
print “inside func1()
@entryExit
def func2():
print “inside func2()”func1()
func2()
print (“*”)*40
#without decorator
def func1_wd():
print “inside func1()”
def func2_wd():
print “inside func2()”
fwd1 = func1_wd
fwd2 = func2_wd
entryExit(fwd1)()
entryExit(fwd2)()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment