Esempio di un decoratore
This commit is contained in:
0
decorators/__init__.py
Normal file
0
decorators/__init__.py
Normal file
19
decorators/main.py
Normal file
19
decorators/main.py
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
def my_decorator(f):
|
||||||
|
def wrap():
|
||||||
|
print('It has a decorator')
|
||||||
|
f()
|
||||||
|
|
||||||
|
return wrap
|
||||||
|
|
||||||
|
|
||||||
|
@my_decorator
|
||||||
|
def my_func():
|
||||||
|
print("The function my_func")
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
my_func()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
Reference in New Issue
Block a user