Dwarka Coding Club Page
#54 Monkey patching in python || Explained in 1 minute || Dwarka Coding Club Page
This video explains the monkey patching in python
Complete playlist: https://www.youtube.com/watch?v=n_F-_atStj8&list=PLLYZEFeS7wKiSN566R0keHLwucMmyXdqR
=============================== Notes =====================================
Monkey patching: for testing purpose, we modify the functionality of a function and after testing, we can set it back to its original functionality
class Sample:
def func1(self):
print("this is func1 from Sample")
def func2(self):
print("this is func2 from Sample")
def monkey_patch(self):
print("this is a patch for testing")
patch = Sample.func2
Sample.func2 = Sample.monkey_patch # monkey patching done
obj = Sample()
obj.func2()
Sample.func2 = patch # functionality restored
obj.func2()
#53 Lambda functions in python || Explained in 1 minute || Dwarka Coding Club Page
This video explains the lambda functions in python
Complete playlist: https://www.youtube.com/watch?v=n_F-_atStj8&list=PLLYZEFeS7wKiSN566R0keHLwucMmyXdqR
=============================== Notes =====================================
Lambda functions: they are anonymous functions which can be used if a single line logic
def square(num):
return num*num
print(square(20))
func = lambda x : x*x
print(func(10))
#51 Decorators in python || Explained in 1 minute || Dwarka Coding Club Page
This video explains the decorators in python
Complete playlist: https://www.youtube.com/watch?v=n_F-_atStj8&list=PLLYZEFeS7wKiSN566R0keHLwucMmyXdqR
=============================== Notes =====================================
Decorator: it can be used to enhance the functionality of a function
def adder(a,b):
print(a+b)
adder(10,20)
def dec(func):
def inner(x,y):
print("before function call")
func(x,y)
print("after function call")
return inner
def adder(a,b):
print(a+b)
adder(10,20)
Click here to claim your Sponsored Listing.
Category
Contact the school
Address
Dwarka Sec-7
Dwa
110075
Opening Hours
| Monday | 3pm - 10pm |
| Tuesday | 3pm - 10pm |
| Wednesday | 3pm - 10pm |
| Thursday | 3pm - 10pm |
| Friday | 3pm - 10pm |
| Saturday | 8am - 10pm |
| Sunday | 8am - 10pm |