I'm trying to understand Python decorators and have written this code:
def hello_world(fn):
print('hello world')
fn()
pass
@hello_world
def decorate():
print('hello decoatrion')
return
decorate()
I was aiming to print 'hello world' before 'hello decoration', but the output is the following:
hello world
hello decoatrion
Traceback (most recent call last):
File "test_decortor.py", line 11, in <module>
decorate()
TypeError: 'NoneType' object is not callable