Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # decorator_demo.py
- # example of decorator
- def sampleDecorator(func):
- def addingFunction():
- # some new statments or flow control
- print("This is the added decorator text to the actual function.")
- # calling the function
- func()
- return addingFunction
- @sampleDecorator
- def actualFunction():
- print("This is the actual function.")
- actualFunction()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement