Python Decorators | Decorators in Python | How to Use it and Why

preview_player
Показать описание
In this Python Programming Tutorial for Beginners video I am going to show you How to use decorators in Python. Decorators wrap a function and modify its behaviour in some way or the
another, without having to directly change the source code of the function being decorated. this is the simple A guide to Python's function decorators. In this video we will Write a function decorator that can be used to measure the run time of a functions.

#PythonTutorialforBeginners #ProgrammingKnowledge #LearnPython #PythonCourse #PythonDecorators #Decorators
★★★Top Online Courses From ProgrammingKnowledge ★★★

★★★ Online Courses to learn ★★★

★★★ Follow ★★★

DISCLAIMER: This video and description contains affiliate links, which means that if you click on one of the product links, I’ll receive a small commission. This help support the channel and allows us to continue to make videos like this. Thank you for the support!
Рекомендации по теме
Комментарии
Автор

thank u sir i got it, you explained very neatly

priyankashinde
Автор

in the second example (at 11:15 min) wrapper_func(), we are returning a/b and also in divide(), we are returning x/y. what is the point then? Where are we using the divide() func inside the wrapper_func() as in the previous example we are using the func() explicitly.

sierraxmike
Автор

I prefer c or c++ programming language becose Python despite it´s oriented object programming language, it´s an intepreted language, thus it´s more slow to compile.

DESTINIA-cfiu
Автор

I have a question sir, it involves python but not this video... How can I fix an empty terminal and an exited code output?

kanini_mathei
Автор

1 def decorator_divide(func):
2 def wrapper_func(a, b):
3 print('divide', a, 'and', b)
4 if b == 0 :
5 print('not divisible')
6 return
7 return a/b
8 return wrapper_func

9 @decorator_divide
10 def divide(x, y):
11 print('being called')
12 return x/y
13
14 #print(result_divide(15, 3))
15 print(divide(15, 5))


the print statement @line 11 is not getting printed.

sierraxmike
Автор

how can i get the first lesson of this programming

amoulaosman
Автор

is there any one can helb me that lesson

amoulaosman