Skip to content

Instantly share code, notes, and snippets.

@timofurrer
Created March 19, 2012 17:17
Show Gist options
  • Save timofurrer/2119854 to your computer and use it in GitHub Desktop.
Save timofurrer/2119854 to your computer and use it in GitHub Desktop.
Python simple decorator example
#!/usr/bin/python
def decorator( fn ):
def wrapper( ):
print( "Befor the function is called" )
fn( )
print( "After the function is called" )
return wrapper
@decorator
def bar( ):
print "Hello World!"
#foo = decorator( bar )
#foo( )
bar( )
@durgesh-k
Copy link

Line 11 - print("Hello World!")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment