mirror of
https://github.com/Hizenberg469/Python-tutorial.git
synced 2026-04-19 23:12:24 +03:00
decorators
This commit is contained in:
20
decorators/decorator.py
Normal file
20
decorators/decorator.py
Normal file
@@ -0,0 +1,20 @@
|
||||
#decorator
|
||||
def my_decorator(func):
|
||||
|
||||
def wrap_func():
|
||||
print('************')
|
||||
func()
|
||||
print('************')
|
||||
|
||||
return wrap_func
|
||||
|
||||
@my_decorator
|
||||
def hello():
|
||||
print('hellllooooooooooo')
|
||||
|
||||
@my_decorator
|
||||
def bye():
|
||||
print('see ya letter')
|
||||
|
||||
hello()
|
||||
bye()
|
||||
Reference in New Issue
Block a user