I have written one method in python as follows :
def report(self,year,month):
print year,month
emptylist=[]
parameter month is optional. Sometimes it's NOT passed from the caller function but sometimes it is passed.How is this different from the following code ? def func(self,*args,**kwargs):print args,kwargs
I know this has simple answer but I'm new to python and programming stuff. Please help me out.
If month
has a default value, you can try
def report(self, year, month='default_value'):
print year, month
emptylist = []
The value of month
gets overwritten if passed
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments