|
@@ -11,20 +11,35 @@ def my_decorator(func):
|
|
|
return wrapper_func
|
|
|
|
|
|
|
|
|
+'''
|
|
|
def decorator(func):
|
|
|
def wrapper():
|
|
|
print('Start decorator')
|
|
|
func()
|
|
|
print('Finish decorator')
|
|
|
return wrapper
|
|
|
+'''
|
|
|
|
|
|
+def decorator(func):
|
|
|
+ def inner(*args, **kwargs):
|
|
|
+ print('Стартуем декоратор')
|
|
|
+ func(*args, **kwargs)
|
|
|
+ print('Заканчиваем декоратор')
|
|
|
+ return inner
|
|
|
|
|
|
@decorator
|
|
|
+def say_hello_to(name, surname):
|
|
|
+ print('hello', name, surname)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+decorator
|
|
|
def my_func():
|
|
|
print('This is my mega function!')
|
|
|
|
|
|
+
|
|
|
def main():
|
|
|
- my_func()
|
|
|
+ say_hello_to('Vasya', 'Ivanov')
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|